[ "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 )
[
}
} ;
-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
{ $subsection inference-error }
"Inference warnings:"
{ $subsection literal-expected }
-{ $subsection cannot-infer-effect }
"Inference errors:"
{ $subsection recursive-quotation-error }
{ $subsection unbalanced-branches-error }
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.