From 16ddd015d342a5caeee124b55608485e05f418c2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Mar 2010 10:22:35 +1300 Subject: [PATCH] typed: forgetting a final class would throw an error while recompiling typed words depending on it --- basis/stack-checker/dependencies/dependencies.factor | 2 +- basis/typed/typed-tests.factor | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/basis/stack-checker/dependencies/dependencies.factor b/basis/stack-checker/dependencies/dependencies.factor index e2f7c57593..7110fa77ab 100644 --- a/basis/stack-checker/dependencies/dependencies.factor +++ b/basis/stack-checker/dependencies/dependencies.factor @@ -141,7 +141,7 @@ TUPLE: depends-on-final class ; [ \ depends-on-final add-conditional-dependency ] bi ; M: depends-on-final satisfied? - class>> final-class? ; + class>> { [ class? ] [ final-class? ] } 1&& ; : init-dependencies ( -- ) H{ } clone dependencies set diff --git a/basis/typed/typed-tests.factor b/basis/typed/typed-tests.factor index 28ec2b6e86..bca1136ee6 100644 --- a/basis/typed/typed-tests.factor +++ b/basis/typed/typed-tests.factor @@ -1,6 +1,6 @@ USING: accessors effects eval kernel layouts math namespaces quotations tools.test typed words words.symbol -compiler.tree.debugger prettyprint ; +compiler.tree.debugger prettyprint definitions compiler.units ; IN: typed.tests TYPED: f+ ( a: float b: float -- c: float ) @@ -149,3 +149,12 @@ SYMBOL: a-symbol a-symbol get ] with-variable ] unit-test + +! Forgetting an unboxed final class should work +TUPLE: forget-class { x read-only } ; final + +TYPED: forget-fail ( a: forget-class -- ) drop ; + +[ ] [ [ \ forget-class forget ] with-compilation-unit ] unit-test + +[ ] [ [ \ forget-fail forget ] with-compilation-unit ] unit-test