From d14d3988953105773d301c3695e8e2d68ce293d2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 7 Sep 2008 02:37:13 -0500 Subject: [PATCH] Tweak stack checker so that we no longer need to do forget-errors during normal usage --- basis/stack-checker/backend/backend.factor | 5 ++++- basis/stack-checker/errors/errors-docs.factor | 6 ------ basis/stack-checker/errors/errors.factor | 8 -------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/basis/stack-checker/backend/backend.factor b/basis/stack-checker/backend/backend.factor index 8a268b79eb..f4cd2c4a8e 100755 --- a/basis/stack-checker/backend/backend.factor +++ b/basis/stack-checker/backend/backend.factor @@ -144,8 +144,11 @@ M: object apply-object push-literal ; [ "inferred-effect" set-word-prop ] 2tri ; +: cannot-infer-effect ( word -- * ) + "cannot-infer" word-prop throw ; + : maybe-cannot-infer ( word quot -- ) - [ ] [ t "cannot-infer" set-word-prop ] cleanup ; inline + [ [ "cannot-infer" set-word-prop ] keep throw ] recover ; inline : infer-word ( word -- effect ) [ diff --git a/basis/stack-checker/errors/errors-docs.factor b/basis/stack-checker/errors/errors-docs.factor index ffe7c26943..f4d7c80e13 100644 --- a/basis/stack-checker/errors/errors-docs.factor +++ b/basis/stack-checker/errors/errors-docs.factor @@ -45,11 +45,6 @@ HELP: too-many-r> } } ; -HELP: cannot-infer-effect -{ $values { "word" word } } -{ $description "Throws a " { $link cannot-infer-effect } " error." } -{ $error-description "Thrown when inference encounters a call to a word which is already known not to have a static stack effect, due to a prior inference attempt failing." } ; - HELP: missing-effect { $error-description "Thrown when inference encounters a word lacking a stack effect declaration. Stack effects of words must be declared, with the exception of words which only push literals on the stack." } { $examples @@ -108,7 +103,6 @@ ARTICLE: "inference-errors" "Inference warnings and errors" { $subsection inference-error } "Inference warnings:" { $subsection literal-expected } -{ $subsection cannot-infer-effect } "Inference errors:" { $subsection recursive-quotation-error } { $subsection unbalanced-branches-error } diff --git a/basis/stack-checker/errors/errors.factor b/basis/stack-checker/errors/errors.factor index 2d962d5fad..3d92aea3e8 100644 --- a/basis/stack-checker/errors/errors.factor +++ b/basis/stack-checker/errors/errors.factor @@ -57,14 +57,6 @@ M: too-many-r> summary drop "Quotation pops retain stack elements which it did not push" ; -TUPLE: cannot-infer-effect word ; - -: cannot-infer-effect ( word -- * ) - \ cannot-infer-effect inference-warning ; - -M: cannot-infer-effect error. - "Unable to infer stack effect of " write word>> . ; - TUPLE: missing-effect word ; M: missing-effect error.