factor/basis/stack-checker/errors/errors.factor

93 lines
2.5 KiB
Factor
Raw Normal View History

2009-03-18 20:44:38 -04:00
! Copyright (C) 2006, 2009 Slava Pestov.
2008-07-20 05:24:37 -04:00
! See http://factorcode.org/license.txt for BSD license.
2008-12-08 15:58:00 -05:00
USING: kernel generic sequences io words arrays summary effects
2009-03-18 20:44:38 -04:00
continuations assocs accessors namespaces compiler.errors
stack-checker.values stack-checker.recursive-state
source-files.errors compiler.errors ;
2008-07-20 05:24:37 -04:00
IN: stack-checker.errors
: pretty-word ( word -- word' )
dup method-body? [ "method-generic" word-prop ] when ;
TUPLE: inference-error error type word ;
2008-07-20 05:24:37 -04:00
M: inference-error error-type type>> ;
2008-07-20 05:24:37 -04:00
: (inference-error) ( ... class type -- * )
2008-12-03 09:46:16 -05:00
[ boa ] dip
recursive-state get word>>
2009-03-18 20:44:38 -04:00
\ inference-error boa rethrow ; inline
2008-07-20 05:24:37 -04:00
: inference-error ( ... class -- * )
+compiler-error+ (inference-error) ; inline
2008-07-20 05:24:37 -04:00
: inference-warning ( ... class -- * )
+compiler-warning+ (inference-error) ; inline
2008-07-20 05:24:37 -04:00
TUPLE: do-not-compile word ;
: do-not-compile ( word -- * ) \ do-not-compile inference-warning ;
TUPLE: literal-expected what ;
: literal-expected ( what -- * ) \ literal-expected inference-warning ;
2008-07-20 05:24:37 -04:00
M: object (literal) "literal value" literal-expected ;
2008-07-20 05:24:37 -04:00
TUPLE: unbalanced-branches-error branches quots ;
: unbalanced-branches-error ( branches quots -- * )
\ unbalanced-branches-error inference-error ;
TUPLE: too-many->r ;
: too-many->r ( -- * ) \ too-many->r inference-error ;
2008-07-20 05:24:37 -04:00
TUPLE: too-many-r> ;
: too-many-r> ( -- * ) \ too-many-r> inference-error ;
2008-07-20 05:24:37 -04:00
TUPLE: missing-effect word ;
: missing-effect ( word -- * )
pretty-word \ missing-effect inference-error ;
TUPLE: effect-error inferred declared ;
2008-07-20 05:24:37 -04:00
: effect-error ( inferred declared -- * )
2008-07-20 05:24:37 -04:00
\ effect-error inference-error ;
TUPLE: recursive-quotation-error quot ;
: recursive-quotation-error ( word -- * )
\ recursive-quotation-error inference-error ;
2008-07-20 05:24:37 -04:00
TUPLE: undeclared-recursion-error word ;
: undeclared-recursion-error ( word -- * )
\ undeclared-recursion-error inference-error ;
2008-07-20 05:24:37 -04:00
TUPLE: diverging-recursion-error word ;
: diverging-recursion-error ( word -- * )
\ diverging-recursion-error inference-error ;
2008-07-20 05:24:37 -04:00
TUPLE: unbalanced-recursion-error word height ;
: unbalanced-recursion-error ( word height -- * )
\ unbalanced-recursion-error inference-error ;
2008-07-20 05:24:37 -04:00
TUPLE: inconsistent-recursive-call-error word ;
: inconsistent-recursive-call-error ( word -- * )
\ inconsistent-recursive-call-error inference-error ;
2008-11-17 12:16:32 -05:00
TUPLE: unknown-primitive-error ;
: unknown-primitive-error ( -- * )
2009-02-27 00:30:48 -05:00
\ unknown-primitive-error inference-warning ;
2009-04-10 08:08:16 -04:00
TUPLE: transform-expansion-error word error ;
: transform-expansion-error ( word error -- * )
\ transform-expansion-error inference-error ;