2010-01-20 16:25:53 -05:00
|
|
|
USING: eval tools.test compiler.units vocabs words kernel
|
|
|
|
definitions sequences ;
|
2009-04-26 01:51:47 -04:00
|
|
|
IN: compiler.tests.redefine10
|
2008-08-30 01:05:27 -04:00
|
|
|
|
2010-01-20 16:25:53 -05:00
|
|
|
! Mixin redefinition should update predicate call sites
|
2008-08-30 01:05:27 -04:00
|
|
|
|
|
|
|
[ ] [
|
2009-09-20 23:42:40 -04:00
|
|
|
"USING: kernel math classes ;
|
2008-08-30 01:05:27 -04:00
|
|
|
IN: compiler.tests.redefine10
|
|
|
|
MIXIN: my-mixin
|
|
|
|
INSTANCE: fixnum my-mixin
|
2010-01-20 16:25:53 -05:00
|
|
|
: my-inline-1 ( a -- b ) dup my-mixin instance? [ 1 + ] when ;
|
|
|
|
: my-inline-2 ( a -- b ) dup my-mixin? [ 1 + ] when ;
|
|
|
|
: my-inline-3 ( a -- b ) dup my-mixin? [ float? ] [ drop f ] if ;
|
|
|
|
: my-inline-4 ( a -- b ) dup float? [ my-mixin? ] [ drop f ] if ;
|
|
|
|
: my-inline-5 ( a -- b ) dup my-mixin? [ fixnum? ] [ drop f ] if ;
|
|
|
|
: my-inline-6 ( a -- b ) dup fixnum? [ my-mixin? ] [ drop f ] if ;"
|
2009-09-20 23:42:40 -04:00
|
|
|
eval( -- )
|
2008-08-30 01:05:27 -04:00
|
|
|
] unit-test
|
|
|
|
|
2010-01-20 16:25:53 -05:00
|
|
|
[ f ] [
|
|
|
|
5 "my-inline-3" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ f ] [
|
|
|
|
5 "my-inline-4" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
5 "my-inline-5" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
5 "my-inline-6" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
2008-08-30 01:05:27 -04:00
|
|
|
[ ] [
|
2009-09-20 23:42:40 -04:00
|
|
|
"USE: math
|
2008-08-30 01:05:27 -04:00
|
|
|
IN: compiler.tests.redefine10
|
2009-09-20 23:42:40 -04:00
|
|
|
INSTANCE: float my-mixin"
|
|
|
|
eval( -- )
|
2008-08-30 01:05:27 -04:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ 2.0 ] [
|
2010-01-20 16:25:53 -05:00
|
|
|
1.0 "my-inline-1" "compiler.tests.redefine10" lookup execute
|
2008-08-30 01:05:27 -04:00
|
|
|
] unit-test
|
2010-01-20 16:25:53 -05:00
|
|
|
|
|
|
|
[ 2.0 ] [
|
|
|
|
1.0 "my-inline-2" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
1.0 "my-inline-3" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
1.0 "my-inline-4" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ f ] [
|
|
|
|
1.0 "my-inline-5" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ f ] [
|
|
|
|
1.0 "my-inline-6" "compiler.tests.redefine10" lookup execute
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"my-mixin" "my-inline-1" "my-inline-2"
|
|
|
|
} [ "compiler.tests.redefine10" lookup forget ] each
|
|
|
|
] with-compilation-unit
|