factor: defer: to DEFER:

locals-and-roots
Doug Coleman 2016-06-22 00:29:01 -07:00
parent d9ddfc5e1b
commit 7e04ce08ab
18 changed files with 38 additions and 38 deletions

View File

@ -72,7 +72,7 @@ STRUCT: forward { x backward* } ;
{ t } [ forward lookup-c-type struct-c-type? ] unit-test
{ t } [ backward lookup-c-type struct-c-type? ] unit-test
defer: struct-redefined
DEFER: struct-redefined
{ f }
[

View File

@ -13,7 +13,7 @@ ERROR: error-class-test a b c ;
[ "in: classes.error.tests ERROR: error-x ; : error-x 3 ;" eval( -- ) ]
[ error>> error>> redefine-error? ] must-fail-with
defer: error-y
DEFER: error-y
{ } [ [ \ error-y dup class? [ forget-class ] [ drop ] if ] with-compilation-unit ] unit-test

View File

@ -29,7 +29,7 @@ M: assoc-mixin collection-size assoc-size ;
{ 2 } [ H{ { 1 2 } { 2 3 } } collection-size ] unit-test
! Test mixing in of new classes after the fact
defer: mx1
DEFER: mx1
forget: mx1
mixin: mx1

View File

@ -48,7 +48,7 @@ TUPLE: test-8 { b integer read-only } ;
{ t } [ "b" test-8 "slots" word-prop slot-named read-only>> ] unit-test
defer: foo
DEFER: foo
[ "IN: classes.tuple.parser.tests TUPLE: foo < test-1 < ;" eval( -- ) ]
[ error>> invalid-slot-name? ]

View File

@ -630,7 +630,7 @@ M: bogus-hashcode-1 hashcode* 2drop 0 >bignum ;
{ } [ T{ bogus-hashcode-2 f T{ bogus-hashcode-1 } } hashcode drop ] unit-test
defer: change-slot-test
DEFER: change-slot-test
slot: kex
{ } [
@ -658,7 +658,7 @@ slot: kex
{ t } [ \ change-slot-test \ kex>> ?lookup-method >boolean ] unit-test
{ f } [ \ change-slot-test \ kex>> ?lookup-method "reading" word-prop ] unit-test
defer: redefine-tuple-twice
DEFER: redefine-tuple-twice
{ } [ "in: classes.tuple.tests TUPLE: redefine-tuple-twice ;" eval( -- ) ] unit-test
@ -752,7 +752,7 @@ TUPLE: g < a-g ;
{ t } [ g new layout-of "g" get layout-of eq? ] unit-test
! Joe Groff discovered this bug
defer: factor-crashes-anymore
DEFER: factor-crashes-anymore
{ } [
"in: classes.tuple.tests
@ -816,7 +816,7 @@ COMPILE< \ rclasstest forget COMPILE>
! initial: should type check
TUPLE: initial-class ;
defer: initial-slot
DEFER: initial-slot
{ } [ "in: classes.tuple.tests TUPLE: initial-slot { x initial-class } ;" eval( -- ) ] unit-test

View File

@ -252,7 +252,7 @@ CONSTANT: case-const-2 2 ;
{ "plus" } [ \ + test-case-7 ] unit-test
{ "plus" } [ \ + \ test-case-7 def>> call ] unit-test
defer: corner-case-1
DEFER: corner-case-1
COMPILE< \ corner-case-1 2 [ + ] curry 1array [ case ] curry ( a -- b ) define-declared COMPILE>

View File

@ -52,7 +52,7 @@ observer add-definition-observer
0 counter set-global
defer: nesting-test
DEFER: nesting-test
{ } [ "in: compiler.units.tests COMPILE< : nesting-test ( -- ) ; COMPILE>" eval( -- ) ] unit-test

View File

@ -144,7 +144,7 @@ PROTOCOL: silly-protocol do-me ;
[ T{ a-tuple } do-me ] [ no-method? ] must-fail-with
! A slot protocol issue
defer: slot-protocol-test-3
DEFER: slot-protocol-test-3
slot: y
{ f } [ \ slot-protocol-test-3 \ y>> ?lookup-method >boolean ] unit-test
@ -179,7 +179,7 @@ TUPLE: slot-protocol-test-3 x y ;"
<string-reader> "delegate-test-2" parse-stream
] unit-test
defer: seq-delegate
DEFER: seq-delegate
! See if removing a consultation updates protocol-consult word prop
{ [ ] } [

View File

@ -147,7 +147,7 @@ M:: string lambda-generic ( a b -- c ) a b lambda-generic-2 ;
\ unparse-test-3 "lambda" word-prop body>> first unparse
] unit-test
defer: xyzzy
DEFER: xyzzy
{ } [
"in: locals.tests use: math GENERIC: xyzzy ( a -- b ) ; M: integer xyzzy ;"

View File

@ -92,7 +92,7 @@ unit-test
! Funny bug
{ 2 } [ "IN: parser.tests : \0. ( -- x ) 2 ; \0." eval( -- n ) ] unit-test
defer: foo
DEFER: foo
"IN: parser.tests USING: math prettyprint ; SYNTAX: foo 2 2 + . ;" eval( -- )
@ -483,7 +483,7 @@ defer: foo
] must-fail-with
! Bogus error message
defer: blahy
DEFER: blahy
[ "IN: parser.tests USE: kernel TUPLE: blahy < tuple ; : blahy ( -- ) ; TUPLE: blahy < tuple ; : blahy ( -- ) ;" eval( -- ) ]
[ error>> error>> def>> \ blahy eq? ] must-fail-with
@ -496,7 +496,7 @@ SYMBOLS: a b c ;
{ b } [ b ] unit-test
{ c } [ c ] unit-test
defer: blah
DEFER: blah
{ } [ "IN: parser.tests GENERIC: blah ( x -- x ) ;" eval( -- ) ] unit-test
{ } [ "IN: parser.tests SYMBOLS: blah ;" eval( -- ) ] unit-test
@ -504,7 +504,7 @@ defer: blah
{ f } [ \ blah generic? ] unit-test
{ t } [ \ blah symbol? ] unit-test
defer: blah1
DEFER: blah1
[ "IN: parser.tests SINGLETONS: blah1 blah1 blah1 ;" eval( -- ) ]
[ error>> error>> def>> \ blah1 eq? ]

View File

@ -2,7 +2,7 @@ USING: assocs compiler.errors compiler.units definitions
namespaces tools.test words ;
IN: source-files.errors.tests
defer: forget-test
DEFER: forget-test
{ } [ [ \ forget-test [ 1 ] ( -- ) define-declared ] with-compilation-unit ] unit-test
{ t } [ \ forget-test compiler-errors get key? ] unit-test

View File

@ -78,7 +78,7 @@ IN: stack-checker.tests
{ 1 2 } [ [ first ] keep second ] must-infer-as
! Mutual recursion
defer: foe
DEFER: foe
: fie ( element obj -- ? )
dup array? [ foe ] [ eq? ] if ;
@ -160,19 +160,19 @@ M: real iterate drop ;
{ 3 0 } [ dog ] must-infer-as
! Regression
defer: monkey
DEFER: monkey
: friend ( a b c -- ) dup [ friend ] [ monkey ] if ;
: monkey ( a b c -- ) dup [ 3drop ] [ friend ] if ;
{ 3 0 } [ friend ] must-infer-as
! Regression -- same as above but we infer the second word first
defer: blah2
DEFER: blah2
: blah ( a b c -- ) dup [ blah ] [ blah2 ] if ;
: blah2 ( a b c -- ) dup [ blah ] [ 3drop ] if ;
{ 3 0 } [ blah2 ] must-infer-as
! Regression
defer: blah4
DEFER: blah4
: blah3 ( a b c -- )
dup [ blah3 ] [ dup [ blah4 ] [ blah3 ] if ] if ;
: blah4 ( a b c -- )
@ -257,7 +257,7 @@ defer: blah4
[ { [ drop ] [ dup ] } dispatch ] infer
] [ word>> \ dispatch eq? ] must-fail-with
defer: inline-recursive-2
DEFER: inline-recursive-2
: inline-recursive-1 ( -- ) inline-recursive-2 ;
: inline-recursive-2 ( -- ) inline-recursive-1 ;
@ -272,11 +272,11 @@ M: string my-hook "a string" ;
{ 0 1 } [ my-hook ] must-infer-as
defer: deferred-word
DEFER: deferred-word
{ 1 1 } [ [ deferred-word ] [ 3 ] if ] must-infer-as
defer: an-inline-word
DEFER: an-inline-word
: normal-word-3 ( -- )
3 [ [ 2 + ] curry ] an-inline-word call drop ;
@ -354,7 +354,7 @@ forget: bad-recursion-3
forget: unbalanced-retain-usage
defer: eee'
DEFER: eee'
: ddd' ( ? -- ) [ f eee' ] when ; inline recursive
: eee' ( ? -- ) [ swap [ ] ] dip ddd' call ; inline recursive

View File

@ -43,7 +43,7 @@ C: <color> color ;
[ bad-new-test ] must-fail
! Corner case if macro expansion calls 'infer', found by Doug
defer: smart-combo
DEFER: smart-combo
\ smart-combo [ infer [ ] curry ] 1 define-transform

View File

@ -12,7 +12,7 @@ IN: words.tests
{ t } [ t loaded-vocab-names [ vocab-words [ word? and ] each ] each ] unit-test
defer: plist-test
DEFER: plist-test
{ t } [
\ plist-test t "sample-property" set-word-prop
@ -64,7 +64,7 @@ forget: another-forgotten
: another-forgotten ( -- ) ;
! Make sure that undefined words throw proper errors
defer: deferred
DEFER: deferred
[ deferred ] [ T{ undefined-word f deferred } = ] must-fail-with
[ "in: words.tests defer: not-compiled COMPILE< not-compiled COMPILE>" eval( -- ) ]

View File

@ -30,7 +30,7 @@ IN: compiler.tree.normalization.tests
{ } [ [ [ 1 ] [ 2 ] if + * ] test-normalization ] unit-test
defer: bbb
DEFER: bbb
: aaa ( obj x -- obj ) dup [ dup [ bbb ] dip aaa ] [ drop ] if ; inline recursive
: bbb ( obj x -- obj ) [ drop 0 ] dip aaa ; inline recursive
@ -40,7 +40,7 @@ defer: bbb
{ } [ [ ccc ] test-normalization ] unit-test
defer: eee
DEFER: eee
: ddd ( a b -- a b ) eee ; inline recursive
: eee ( a b -- a b ) swap ddd ; inline recursive

View File

@ -79,7 +79,7 @@ IN: compiler.tree.recursive.tests
: blah ( -- value ) f ;
defer: a
DEFER: a
: b ( -- )
blah [ b ] [ a ] if ; inline recursive
@ -107,7 +107,7 @@ defer: a
\ b label-is-loop?
] unit-test
defer: a'
DEFER: a'
: b' ( -- )
blah [ b' b' ] [ a' ] if ; inline recursive
@ -139,7 +139,7 @@ defer: a'
\ b' label-is-loop?
] unit-test
defer: a''
DEFER: a''
: b'' ( a -- b )
a'' ; inline recursive
@ -178,7 +178,7 @@ defer: a''
\ (each-integer) label-is-loop?
] unit-test
defer: a'''
DEFER: a'''
: b''' ( -- )
blah [ b''' ] [ a''' b''' ] if ; inline recursive
@ -191,7 +191,7 @@ defer: a'''
\ a''' label-is-loop?
] unit-test
defer: b4
DEFER: b4
: a4 ( a -- b ) dup [ b4 ] when ; inline recursive

View File

@ -163,7 +163,7 @@ M: object method-layout ;
"soft-break-layout" soft-break-test check-see
] unit-test
defer: parse-error-file
DEFER: parse-error-file
: another-soft-break-test ( -- str )
{

View File

@ -1,7 +1,7 @@
USING: compiler.errors stack-checker.errors tools.test words ;
IN: tools.errors
defer: blah
DEFER: blah
{ } [
{