1 IN: compiler.tests.redefine0
2 USING: tools.test eval compiler compiler.errors compiler.units definitions kernel math ;
4 ! Test ripple-up behavior
6 : test-2 ( -- ) test-1 ;
8 [ test-2 ] [ not-compiled? ] must-fail-with
10 [ ] [ "IN: compiler.tests.redefine0 : test-1 ( -- ) ;" eval( -- ) ] unit-test
12 { 0 0 } [ test-1 ] must-infer-as
14 [ ] [ test-2 ] unit-test
20 ] with-compilation-unit
23 : test-3 ( a -- ) drop ;
24 : test-4 ( -- ) [ 1 2 3 ] test-3 ;
26 [ ] [ test-4 ] unit-test
28 [ ] [ "IN: compiler.tests.redefine0 USE: kernel : test-3 ( a -- ) call ; inline" eval( -- ) ] unit-test
30 [ test-4 ] [ not-compiled? ] must-fail-with
36 ] with-compilation-unit
39 : test-5 ( a -- quot ) ;
40 : test-6 ( a -- b ) test-5 ;
42 [ 31337 ] [ 31337 test-6 ] unit-test
44 [ ] [ "IN: compiler.tests.redefine0 USING: macros kernel ; MACRO: test-5 ( a -- quot ) drop [ ] ;" eval( -- ) ] unit-test
46 [ 31337 test-6 ] [ not-compiled? ] must-fail-with
52 ] with-compilation-unit
55 GENERIC: test-7 ( a -- b )
59 : test-8 ( a -- b ) 255 bitand test-7 ;
61 [ 1 test-7 ] [ not-compiled? ] must-fail-with
62 [ 1 test-8 ] [ not-compiled? ] must-fail-with
64 [ ] [ "IN: compiler.tests.redefine0 USING: macros kernel ; GENERIC: test-7 ( x y -- z )" eval( -- ) ] unit-test
66 [ 4 ] [ 1 3 test-7 ] unit-test
67 [ 4 ] [ 1 259 test-8 ] unit-test
73 ] with-compilation-unit