From 8f1240cf966edb5ec627cb2d56462b900ec95a94 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 13 Mar 2009 00:40:18 -0500 Subject: [PATCH] Forgetting a word doesn't call reset-word anymore, fixing an issue where a word calling a forgotten word wouldn't compile because the 'declared-effect' word prop was not set --- basis/stack-checker/stack-checker-tests.factor | 11 +++++++++-- core/classes/classes.factor | 5 ++++- core/words/words-tests.factor | 14 +++++++------- core/words/words.factor | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/basis/stack-checker/stack-checker-tests.factor b/basis/stack-checker/stack-checker-tests.factor index c881ccee11..3d8c2cdd8c 100644 --- a/basis/stack-checker/stack-checker-tests.factor +++ b/basis/stack-checker/stack-checker-tests.factor @@ -7,7 +7,7 @@ sorting assocs definitions prettyprint io inspector classes.tuple classes.union classes.predicate debugger threads.private io.streams.string io.timeouts io.thread sequences.private destructors combinators eval locals.backend -system ; +system compiler.units ; IN: stack-checker.tests \ infer. must-infer @@ -580,4 +580,11 @@ DEFER: eee' [ [ ] debugging-curry-folding ] must-infer -[ [ exit ] [ 1 2 3 ] if ] must-infer \ No newline at end of file +[ [ exit ] [ 1 2 3 ] if ] must-infer + +! Stack effects are required now but FORGET: clears them... +: forget-test ( -- ) ; + +[ forget-test ] must-infer +[ ] [ [ \ forget-test forget ] with-compilation-unit ] unit-test +[ forget-test ] must-infer \ No newline at end of file diff --git a/core/classes/classes.factor b/core/classes/classes.factor index 8145730f40..888eac7645 100644 --- a/core/classes/classes.factor +++ b/core/classes/classes.factor @@ -42,8 +42,11 @@ PREDICATE: class < word "class" word-prop ; PREDICATE: predicate < word "predicating" word-prop >boolean ; +M: predicate forget* + [ call-next-method ] [ f "predicating" set-word-prop ] bi ; + M: predicate reset-word - [ call-next-method ] [ { "predicating" } reset-props ] bi ; + [ call-next-method ] [ f "predicating" set-word-prop ] bi ; : define-predicate ( class quot -- ) [ "predicate" word-prop first ] dip diff --git a/core/words/words-tests.factor b/core/words/words-tests.factor index a22b6a5b97..52a20ba48a 100755 --- a/core/words/words-tests.factor +++ b/core/words/words-tests.factor @@ -55,18 +55,18 @@ GENERIC: testing [ f ] [ \ testing generic? ] unit-test -: forgotten ; -: another-forgotten ; +: forgotten ( -- ) ; +: another-forgotten ( -- ) ; FORGET: forgotten FORGET: another-forgotten -: another-forgotten ; +: another-forgotten ( -- ) ; ! I forgot remove-crossref calls! -: fee ; -: foe fee ; -: fie foe ; +: fee ( -- ) ; +: foe ( -- ) fee ; +: fie ( -- ) foe ; [ t ] [ \ fee usage [ word? ] filter empty? ] unit-test [ t ] [ \ foe usage empty? ] unit-test @@ -97,7 +97,7 @@ DEFER: calls-a-gensym ! more xref buggery [ f ] [ GENERIC: xyzzle ( x -- x ) - : a ; \ a + : a ( -- ) ; \ a M: integer xyzzle a ; FORGET: a M: object xyzzle ; diff --git a/core/words/words.factor b/core/words/words.factor index c27ea4fd8f..cd11fb2db1 100755 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -248,7 +248,7 @@ M: word forget* dup "forgotten" word-prop [ drop ] [ [ delete-xref ] [ [ name>> ] [ vocabulary>> vocab-words ] bi delete-at ] - [ [ reset-word ] [ t "forgotten" set-word-prop ] bi ] + [ t "forgotten" set-word-prop ] tri ] if ; -- 2.34.1