class: RegressionTests::CompilerTests2
added: #test_04
changed: #test_03
Added tests for bugs introduced by (likely) CG.
--- a/RegressionTests__CompilerTests2.st Thu Aug 22 21:43:34 2013 +0200
+++ b/RegressionTests__CompilerTests2.st Tue Aug 27 03:43:24 2013 +0200
@@ -618,48 +618,33 @@
!
test_03
- "JV@2012-10-26:
+ "JV@2013-10-27:
- When a method is compiled programmaticallu from
- __FROM WORKSPACE__ AND a method uses a class that is not yet loaded,
- then the compiler as of 2013-06-24 generates access to a workspace variable
- instead of access to a global
-
- This tests checks for this bug
+ As of 2013-10-27 parser crashes on DNU when a message
+ is constant-folded.
"
- | ws m1 m2 |
-
- "/ this test only works with a Display...
- self skipIf:[Display isNil] description:'Test requires a Display'.
-
- "/First, make sure that package is not yet loaded...
- self
- assert: (Smalltalk at: #'RegressionTests::CompilerTests2Mock1') isNil
- description: 'RegressionTests::CompilerTests2Mock1 already loaded'.
-
- Smalltalk fileIn:'RegressionTests__CompilerTests2Mock1.st' inPackage:#'exept:regression/testData/CompilerTests2'.
-
- self
- assert: (Smalltalk at: #'RegressionTests::CompilerTests2Mock1') notNil
- description: 'RegressionTests::CompilerTests2Mock1 failed to load'.
-
-
- ws := WorkspaceApplication new.
- ws selectedWorkspace
- autoDefineVariables: #workspace;
- contents: 'RegressionTests::CompilerTests2Mock1 recompile';
- selectAll;
- doIt.
-
- m1 := (Smalltalk at: #'RegressionTests::CompilerTests2Mock1') compiledMethodAt: #foo.
- m2 := (Smalltalk at: #'RegressionTests::CompilerTests2Mock1') compiledMethodAt: #bar.
-
- self assert: (m1 literals allSatisfy:[:e|e class ~~ ValueHolder]).
- self assert: (m2 literals allSatisfy:[:e|e class ~~ ValueHolder]).
+ self compile: 'mock_03 ^ 1 perform: #+ with: 2' mode: #bc.
+ self assert: self bc_mock_03 == 3
"Created: / 24-06-2013 / 14:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (comment): / 24-06-2013 / 15:33:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 27-08-2013 / 02:38:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_04
+ "JV@2013-10-27:
+
+ As of 2013-10-27 bytecode compiler generates invalid code
+ for perform:* with constant symbol. That's because
+ in Parser, rev 1.781 >> keywordExpressionFor:, line 57 the
+ selector is reser back to the original, overwriting the one
+ set by constant-folding method.
+ "
+
+ self compile: 'mock_04:x x perform: #+ with: 2' mode: #bc.
+ self assert: (self bc_mock_04:2) == 4
+
+ "Created: / 27-08-2013 / 02:37:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CompilerTests2 methodsFor:'tests - arg & var names'!