Compiler warnings are no more
parent
c074c2c93b
commit
5649cc7a0a
|
@ -68,9 +68,11 @@ SYMBOL: bootstrap-time
|
||||||
"staging" get "deploy-vocab" get or [
|
"staging" get "deploy-vocab" get or [
|
||||||
"stage2: deployment mode" print
|
"stage2: deployment mode" print
|
||||||
] [
|
] [
|
||||||
"listener" require
|
|
||||||
"debugger" require
|
"debugger" require
|
||||||
|
"alien.prettyprint" require
|
||||||
|
"inspector" require
|
||||||
"tools.errors" require
|
"tools.errors" require
|
||||||
|
"listener" require
|
||||||
"none" require
|
"none" require
|
||||||
] if
|
] if
|
||||||
|
|
||||||
|
|
|
@ -375,45 +375,21 @@ M: long-long-type flatten-value-type ( type -- types )
|
||||||
: box-return* ( node -- )
|
: box-return* ( node -- )
|
||||||
return>> [ ] [ box-return ] if-void ;
|
return>> [ ] [ box-return ] if-void ;
|
||||||
|
|
||||||
TUPLE: no-such-library name ;
|
|
||||||
|
|
||||||
M: no-such-library summary
|
|
||||||
drop "Library not found" ;
|
|
||||||
|
|
||||||
M: no-such-library error-type drop +linkage-error+ ;
|
|
||||||
|
|
||||||
: no-such-library ( name -- )
|
|
||||||
\ no-such-library boa
|
|
||||||
compiling-word get compiler-error ;
|
|
||||||
|
|
||||||
TUPLE: no-such-symbol name ;
|
|
||||||
|
|
||||||
M: no-such-symbol summary
|
|
||||||
drop "Symbol not found" ;
|
|
||||||
|
|
||||||
M: no-such-symbol error-type drop +linkage-error+ ;
|
|
||||||
|
|
||||||
: no-such-symbol ( name -- )
|
|
||||||
\ no-such-symbol boa
|
|
||||||
compiling-word get compiler-error ;
|
|
||||||
|
|
||||||
: check-dlsym ( symbols dll -- )
|
: check-dlsym ( symbols dll -- )
|
||||||
dup dll-valid? [
|
dup dll-valid? [
|
||||||
dupd '[ _ dlsym ] any?
|
dupd '[ _ dlsym ] any?
|
||||||
[ drop ] [ no-such-symbol ] if
|
[ drop ] [ compiling-word get no-such-symbol ] if
|
||||||
] [
|
] [
|
||||||
dll-path no-such-library drop
|
dll-path compiling-word get no-such-library drop
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: stdcall-mangle ( symbol node -- symbol )
|
: stdcall-mangle ( symbol params -- symbol )
|
||||||
"@"
|
parameters>> parameter-sizes drop number>string "@" glue ;
|
||||||
swap parameters>> parameter-sizes drop
|
|
||||||
number>string 3append ;
|
|
||||||
|
|
||||||
: alien-invoke-dlsym ( params -- symbols dll )
|
: alien-invoke-dlsym ( params -- symbols dll )
|
||||||
dup function>> dup pick stdcall-mangle 2array
|
[ [ function>> dup ] keep stdcall-mangle 2array ]
|
||||||
swap library>> library dup [ dll>> ] when
|
[ library>> library dup [ dll>> ] when ]
|
||||||
2dup check-dlsym ;
|
bi 2dup check-dlsym ;
|
||||||
|
|
||||||
M: ##alien-invoke generate-insn
|
M: ##alien-invoke generate-insn
|
||||||
params>>
|
params>>
|
||||||
|
|
|
@ -29,7 +29,7 @@ $nl
|
||||||
$nl
|
$nl
|
||||||
"The " { $link compile-word } " word performs the actual task of compiling an individual word. The process proceeds as follows:"
|
"The " { $link compile-word } " word performs the actual task of compiling an individual word. The process proceeds as follows:"
|
||||||
{ $list
|
{ $list
|
||||||
{ "The " { $link frontend } " word calls " { $link build-tree } ". If this fails, the error is passed to " { $link deoptimize } ". The logic for ignoring compile warnings generated for inline words and macros is located here. If the error is not ignorable, it is added to the global " { $link compiler-errors } " assoc (see " { $link "compiler-errors" } ")." }
|
{ "The " { $link frontend } " word calls " { $link build-tree } ". If this fails, the error is passed to " { $link deoptimize } ". The logic for ignoring certain compile errors generated for inline words and macros is located here. If the error is not ignorable, it is added to the global " { $link compiler-errors } " assoc (see " { $link "compiler-errors" } ")." }
|
||||||
{ "If the word contains a breakpoint, compilation ends here. Otherwise, all remaining steps execute until machine code is generated. Any further errors thrown by the compiler are not reported as compile errors, but instead are ordinary exceptions. This is because they indicate bugs in the compiler, not errors in user code." }
|
{ "If the word contains a breakpoint, compilation ends here. Otherwise, all remaining steps execute until machine code is generated. Any further errors thrown by the compiler are not reported as compile errors, but instead are ordinary exceptions. This is because they indicate bugs in the compiler, not errors in user code." }
|
||||||
{ "The " { $link frontend } " word then calls " { $link optimize-tree } ". This produces the final optimized tree IR, and this stage of the compiler is complete." }
|
{ "The " { $link frontend } " word then calls " { $link optimize-tree } ". This produces the final optimized tree IR, and this stage of the compiler is complete." }
|
||||||
{ "The " { $link backend } " word calls " { $link build-cfg } " followed by " { $link optimize-cfg } " and a few other stages. Finally, it calls " { $link save-asm } ", and adds any uncompiled words called by this word to the compilation queue with " { $link compile-dependency } "." }
|
{ "The " { $link backend } " word calls " { $link build-cfg } " followed by " { $link optimize-cfg } " and a few other stages. Finally, it calls " { $link save-asm } ", and adds any uncompiled words called by this word to the compilation queue with " { $link compile-dependency } "." }
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel namespaces arrays sequences io words fry
|
USING: accessors kernel namespaces arrays sequences io words fry
|
||||||
continuations vocabs assocs dlists definitions math graphs generic
|
continuations vocabs assocs dlists definitions math graphs generic
|
||||||
combinators deques search-deques macros io source-files.errors stack-checker
|
combinators deques search-deques macros io source-files.errors
|
||||||
stack-checker.state stack-checker.inlining combinators.short-circuit
|
stack-checker stack-checker.state stack-checker.inlining
|
||||||
compiler.errors compiler.units compiler.tree.builder
|
stack-checker.errors combinators.short-circuit compiler.errors
|
||||||
compiler.tree.optimizer compiler.cfg.builder compiler.cfg.optimizer
|
compiler.units compiler.tree.builder compiler.tree.optimizer
|
||||||
compiler.cfg.linearization compiler.cfg.two-operand
|
compiler.cfg.builder compiler.cfg.optimizer compiler.cfg.linearization
|
||||||
compiler.cfg.linear-scan compiler.cfg.stack-frame compiler.codegen
|
compiler.cfg.two-operand compiler.cfg.linear-scan
|
||||||
compiler.utilities ;
|
compiler.cfg.stack-frame compiler.codegen compiler.utilities ;
|
||||||
IN: compiler
|
IN: compiler
|
||||||
|
|
||||||
SYMBOL: compile-queue
|
SYMBOL: compile-queue
|
||||||
|
@ -39,10 +39,10 @@ SYMBOL: compiled
|
||||||
"trace-compilation" get [ dup name>> print flush ] when
|
"trace-compilation" get [ dup name>> print flush ] when
|
||||||
H{ } clone dependencies set
|
H{ } clone dependencies set
|
||||||
H{ } clone generic-dependencies set
|
H{ } clone generic-dependencies set
|
||||||
f swap compiler-error ;
|
clear-compiler-error ;
|
||||||
|
|
||||||
: ignore-error? ( word error -- ? )
|
: ignore-error? ( word error -- ? )
|
||||||
#! Ignore warnings on inline combinators, macros, and special
|
#! Ignore some errors on inline combinators, macros, and special
|
||||||
#! words such as 'call'.
|
#! words such as 'call'.
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,12 @@ SYMBOL: compiled
|
||||||
[ "special" word-prop ]
|
[ "special" word-prop ]
|
||||||
[ "no-compile" word-prop ]
|
[ "no-compile" word-prop ]
|
||||||
} 1||
|
} 1||
|
||||||
] [ error-type +compiler-warning+ eq? ] bi* and ;
|
] [
|
||||||
|
{
|
||||||
|
[ do-not-compile? ]
|
||||||
|
[ literal-expected? ]
|
||||||
|
} 1||
|
||||||
|
] bi* and ;
|
||||||
|
|
||||||
: finish ( word -- )
|
: finish ( word -- )
|
||||||
#! Recompile callers if the word's stack effect changed, then
|
#! Recompile callers if the word's stack effect changed, then
|
||||||
|
@ -80,10 +85,16 @@ SYMBOL: compiled
|
||||||
#! non-optimizing compiler, using its definition. Otherwise,
|
#! non-optimizing compiler, using its definition. Otherwise,
|
||||||
#! if the compiler error is not ignorable, use a dummy
|
#! if the compiler error is not ignorable, use a dummy
|
||||||
#! definition from 'not-compiled-def' which throws an error.
|
#! definition from 'not-compiled-def' which throws an error.
|
||||||
2dup ignore-error?
|
2dup ignore-error? [
|
||||||
[ drop f over def>> ]
|
drop
|
||||||
[ 2dup not-compiled-def ] if
|
[ dup def>> deoptimize-with ]
|
||||||
[ swap compiler-error ] [ deoptimize-with ] bi-curry* bi ;
|
[ clear-compiler-error ]
|
||||||
|
bi
|
||||||
|
] [
|
||||||
|
[ swap <compiler-error> compiler-error ]
|
||||||
|
[ [ drop ] [ not-compiled-def ] 2bi deoptimize-with ]
|
||||||
|
2bi
|
||||||
|
] if ;
|
||||||
|
|
||||||
: frontend ( word -- nodes )
|
: frontend ( word -- nodes )
|
||||||
#! If the word contains breakpoints, don't optimize it, since
|
#! If the word contains breakpoints, don't optimize it, since
|
||||||
|
|
|
@ -1,56 +1,72 @@
|
||||||
! Copyright (C) 2007, 2009 Slava Pestov.
|
! Copyright (C) 2007, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors source-files.errors kernel namespaces assocs ;
|
USING: accessors source-files.errors kernel namespaces assocs fry
|
||||||
|
summary ;
|
||||||
IN: compiler.errors
|
IN: compiler.errors
|
||||||
|
|
||||||
TUPLE: compiler-error < source-file-error ;
|
SYMBOL: +compiler-error+
|
||||||
|
|
||||||
M: compiler-error error-type error>> error-type ;
|
|
||||||
|
|
||||||
SYMBOL: compiler-errors
|
SYMBOL: compiler-errors
|
||||||
|
|
||||||
compiler-errors [ H{ } clone ] initialize
|
compiler-errors [ H{ } clone ] initialize
|
||||||
|
|
||||||
SYMBOLS: +compiler-error+ +compiler-warning+ +linkage-error+ ;
|
TUPLE: compiler-error < source-file-error ;
|
||||||
|
|
||||||
: errors-of-type ( type -- assoc )
|
M: compiler-error error-type drop +compiler-error+ ;
|
||||||
compiler-errors get-global
|
|
||||||
swap [ [ nip error-type ] dip eq? ] curry
|
SYMBOL: +linkage-error+
|
||||||
assoc-filter ;
|
SYMBOL: linkage-errors
|
||||||
|
|
||||||
|
linkage-errors [ H{ } clone ] initialize
|
||||||
|
|
||||||
|
TUPLE: linkage-error < source-file-error ;
|
||||||
|
|
||||||
|
M: linkage-error error-type drop +linkage-error+ ;
|
||||||
|
|
||||||
|
: clear-compiler-error ( word -- )
|
||||||
|
compiler-errors linkage-errors
|
||||||
|
[ get-global delete-at ] bi-curry@ bi ;
|
||||||
|
|
||||||
|
: compiler-error ( error -- )
|
||||||
|
dup asset>> compiler-errors get-global set-at ;
|
||||||
|
|
||||||
T{ error-type
|
T{ error-type
|
||||||
{ type +compiler-error+ }
|
{ type +compiler-error+ }
|
||||||
{ word ":errors" }
|
{ word ":errors" }
|
||||||
{ plural "compiler errors" }
|
{ plural "compiler errors" }
|
||||||
{ icon "vocab:ui/tools/error-list/icons/compiler-error.tiff" }
|
{ icon "vocab:ui/tools/error-list/icons/compiler-error.tiff" }
|
||||||
{ quot [ +compiler-error+ errors-of-type values ] }
|
{ quot [ compiler-errors get values ] }
|
||||||
{ forget-quot [ compiler-errors get delete-at ] }
|
{ forget-quot [ compiler-errors get delete-at ] }
|
||||||
} define-error-type
|
} define-error-type
|
||||||
|
|
||||||
T{ error-type
|
: <compiler-error> ( error word -- compiler-error )
|
||||||
{ type +compiler-warning+ }
|
\ compiler-error <definition-error> ;
|
||||||
{ word ":warnings" }
|
|
||||||
{ plural "compiler warnings" }
|
: <linkage-error> ( error word -- linkage-error )
|
||||||
{ icon "vocab:ui/tools/error-list/icons/compiler-warning.tiff" }
|
\ linkage-error <definition-error> ;
|
||||||
{ quot [ +compiler-warning+ errors-of-type values ] }
|
|
||||||
{ forget-quot [ compiler-errors get delete-at ] }
|
: linkage-error ( error word class -- )
|
||||||
} define-error-type
|
'[ _ boa ] dip <linkage-error> dup asset>> linkage-errors get set-at ; inline
|
||||||
|
|
||||||
T{ error-type
|
T{ error-type
|
||||||
{ type +linkage-error+ }
|
{ type +linkage-error+ }
|
||||||
{ word ":linkage" }
|
{ word ":linkage" }
|
||||||
{ plural "linkage errors" }
|
{ plural "linkage errors" }
|
||||||
{ icon "vocab:ui/tools/error-list/icons/linkage-error.tiff" }
|
{ icon "vocab:ui/tools/error-list/icons/linkage-error.tiff" }
|
||||||
{ quot [ +linkage-error+ errors-of-type values ] }
|
{ quot [ linkage-errors get values ] }
|
||||||
{ forget-quot [ compiler-errors get delete-at ] }
|
{ forget-quot [ linkage-errors get delete-at ] }
|
||||||
{ fatal? f }
|
{ fatal? f }
|
||||||
} define-error-type
|
} define-error-type
|
||||||
|
|
||||||
: <compiler-error> ( error word -- compiler-error )
|
TUPLE: no-such-library name ;
|
||||||
\ compiler-error <definition-error> ;
|
|
||||||
|
|
||||||
: compiler-error ( error word -- )
|
M: no-such-library summary drop "Library not found" ;
|
||||||
compiler-errors get-global pick
|
|
||||||
[ [ [ <compiler-error> ] keep ] dip set-at ] [ delete-at drop ] if ;
|
: no-such-library ( name word -- ) \ no-such-library linkage-error ;
|
||||||
|
|
||||||
|
TUPLE: no-such-symbol name ;
|
||||||
|
|
||||||
|
M: no-such-symbol summary drop "Symbol not found" ;
|
||||||
|
|
||||||
|
: no-such-symbol ( name word -- ) \ no-such-symbol linkage-error ;
|
||||||
|
|
||||||
ERROR: not-compiled word error ;
|
ERROR: not-compiled word error ;
|
|
@ -15,7 +15,7 @@ IN: compiler.tree.builder
|
||||||
|
|
||||||
GENERIC: (build-tree) ( quot -- )
|
GENERIC: (build-tree) ( quot -- )
|
||||||
|
|
||||||
M: callable (build-tree) f initial-recursive-state infer-quot ;
|
M: callable (build-tree) infer-quot-here ;
|
||||||
|
|
||||||
: check-no-compile ( word -- )
|
: check-no-compile ( word -- )
|
||||||
dup "no-compile" word-prop [ do-not-compile ] [ drop ] if ;
|
dup "no-compile" word-prop [ do-not-compile ] [ drop ] if ;
|
||||||
|
@ -31,15 +31,13 @@ M: callable (build-tree) f initial-recursive-state infer-quot ;
|
||||||
dup inline-recursive? [ 1quotation ] [ specialized-def ] if ;
|
dup inline-recursive? [ 1quotation ] [ specialized-def ] if ;
|
||||||
|
|
||||||
M: word (build-tree)
|
M: word (build-tree)
|
||||||
{
|
[ check-no-compile ]
|
||||||
[ initial-recursive-state recursive-state set ]
|
[ word-body infer-quot-here ]
|
||||||
[ check-no-compile ]
|
[ current-effect check-effect ] tri ;
|
||||||
[ word-body infer-quot-here ]
|
|
||||||
[ current-effect check-effect ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: build-tree-with ( in-stack word/quot -- nodes )
|
: build-tree-with ( in-stack word/quot -- nodes )
|
||||||
[
|
[
|
||||||
|
<recursive-state> recursive-state set
|
||||||
V{ } clone stack-visitor set
|
V{ } clone stack-visitor set
|
||||||
[ [ >vector \ meta-d set ] [ length d-in set ] bi ]
|
[ [ >vector \ meta-d set ] [ length d-in set ] bi ]
|
||||||
[ (build-tree) ]
|
[ (build-tree) ]
|
||||||
|
|
|
@ -101,8 +101,6 @@ $nl
|
||||||
{ $subsection recursive-quotation-error }
|
{ $subsection recursive-quotation-error }
|
||||||
{ $subsection too-many->r }
|
{ $subsection too-many->r }
|
||||||
{ $subsection too-many-r> }
|
{ $subsection too-many-r> }
|
||||||
{ $subsection missing-effect }
|
{ $subsection missing-effect } ;
|
||||||
"Main wrapper for all inference warnings and errors:"
|
|
||||||
{ $subsection inference-error } ;
|
|
||||||
|
|
||||||
ABOUT: "inference-errors"
|
ABOUT: "inference-errors"
|
||||||
|
|
|
@ -1,93 +1,36 @@
|
||||||
! Copyright (C) 2006, 2009 Slava Pestov.
|
! Copyright (C) 2006, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel generic sequences io words arrays summary effects
|
USING: kernel stack-checker.values ;
|
||||||
continuations assocs accessors namespaces compiler.errors
|
|
||||||
stack-checker.values stack-checker.recursive-state
|
|
||||||
source-files.errors compiler.errors ;
|
|
||||||
IN: stack-checker.errors
|
IN: stack-checker.errors
|
||||||
|
|
||||||
: pretty-word ( word -- word' )
|
TUPLE: inference-error ;
|
||||||
dup method-body? [ "method-generic" word-prop ] when ;
|
|
||||||
|
|
||||||
TUPLE: inference-error error type word ;
|
ERROR: do-not-compile < inference-error word ;
|
||||||
|
|
||||||
M: inference-error error-type type>> ;
|
ERROR: literal-expected < inference-error what ;
|
||||||
|
|
||||||
: (inference-error) ( ... class type -- * )
|
ERROR: unbalanced-branches-error < inference-error branches quots ;
|
||||||
[ boa ] dip
|
|
||||||
recursive-state get word>>
|
|
||||||
\ inference-error boa rethrow ; inline
|
|
||||||
|
|
||||||
: inference-error ( ... class -- * )
|
ERROR: too-many->r < inference-error ;
|
||||||
+compiler-error+ (inference-error) ; inline
|
|
||||||
|
|
||||||
: inference-warning ( ... class -- * )
|
ERROR: too-many-r> < inference-error ;
|
||||||
+compiler-warning+ (inference-error) ; inline
|
|
||||||
|
|
||||||
TUPLE: do-not-compile word ;
|
ERROR: missing-effect < inference-error word ;
|
||||||
|
|
||||||
: do-not-compile ( word -- * ) \ do-not-compile inference-warning ;
|
ERROR: effect-error < inference-error inferred declared ;
|
||||||
|
|
||||||
TUPLE: literal-expected what ;
|
ERROR: recursive-quotation-error < inference-error quot ;
|
||||||
|
|
||||||
: literal-expected ( what -- * ) \ literal-expected inference-warning ;
|
ERROR: undeclared-recursion-error < inference-error word ;
|
||||||
|
|
||||||
M: object (literal) "literal value" literal-expected ;
|
ERROR: diverging-recursion-error < inference-error word ;
|
||||||
|
|
||||||
TUPLE: unbalanced-branches-error branches quots ;
|
ERROR: unbalanced-recursion-error < inference-error word height ;
|
||||||
|
|
||||||
: unbalanced-branches-error ( branches quots -- * )
|
ERROR: inconsistent-recursive-call-error < inference-error word ;
|
||||||
\ unbalanced-branches-error inference-error ;
|
|
||||||
|
|
||||||
TUPLE: too-many->r ;
|
ERROR: unknown-primitive-error < inference-error ;
|
||||||
|
|
||||||
: too-many->r ( -- * ) \ too-many->r inference-error ;
|
ERROR: transform-expansion-error < inference-error word error ;
|
||||||
|
|
||||||
TUPLE: too-many-r> ;
|
M: object (literal) "literal value" literal-expected ;
|
||||||
|
|
||||||
: too-many-r> ( -- * ) \ too-many-r> inference-error ;
|
|
||||||
|
|
||||||
TUPLE: missing-effect word ;
|
|
||||||
|
|
||||||
: missing-effect ( word -- * )
|
|
||||||
pretty-word \ missing-effect inference-error ;
|
|
||||||
|
|
||||||
TUPLE: effect-error inferred declared ;
|
|
||||||
|
|
||||||
: effect-error ( inferred declared -- * )
|
|
||||||
\ effect-error inference-error ;
|
|
||||||
|
|
||||||
TUPLE: recursive-quotation-error quot ;
|
|
||||||
|
|
||||||
: recursive-quotation-error ( word -- * )
|
|
||||||
\ recursive-quotation-error inference-error ;
|
|
||||||
|
|
||||||
TUPLE: undeclared-recursion-error word ;
|
|
||||||
|
|
||||||
: undeclared-recursion-error ( word -- * )
|
|
||||||
\ undeclared-recursion-error inference-error ;
|
|
||||||
|
|
||||||
TUPLE: diverging-recursion-error word ;
|
|
||||||
|
|
||||||
: diverging-recursion-error ( word -- * )
|
|
||||||
\ diverging-recursion-error inference-error ;
|
|
||||||
|
|
||||||
TUPLE: unbalanced-recursion-error word height ;
|
|
||||||
|
|
||||||
: unbalanced-recursion-error ( word height -- * )
|
|
||||||
\ unbalanced-recursion-error inference-error ;
|
|
||||||
|
|
||||||
TUPLE: inconsistent-recursive-call-error word ;
|
|
||||||
|
|
||||||
: inconsistent-recursive-call-error ( word -- * )
|
|
||||||
\ inconsistent-recursive-call-error inference-error ;
|
|
||||||
|
|
||||||
TUPLE: unknown-primitive-error ;
|
|
||||||
|
|
||||||
: unknown-primitive-error ( -- * )
|
|
||||||
\ unknown-primitive-error inference-warning ;
|
|
||||||
|
|
||||||
TUPLE: transform-expansion-error word error ;
|
|
||||||
|
|
||||||
: transform-expansion-error ( word error -- * )
|
|
||||||
\ transform-expansion-error inference-error ;
|
|
|
@ -1,18 +1,11 @@
|
||||||
! Copyright (C) 2008, 2009 Slava Pestov.
|
! Copyright (C) 2008, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel prettyprint io debugger
|
USING: accessors kernel prettyprint io debugger
|
||||||
sequences assocs stack-checker.errors summary effects make ;
|
sequences assocs stack-checker.errors summary effects ;
|
||||||
IN: stack-checker.errors.prettyprint
|
IN: stack-checker.errors.prettyprint
|
||||||
|
|
||||||
M: inference-error summary error>> summary ;
|
|
||||||
|
|
||||||
M: inference-error error-help error>> error-help ;
|
|
||||||
|
|
||||||
M: inference-error error.
|
|
||||||
[ word>> [ "In word: " write . ] when* ] [ error>> error. ] bi ;
|
|
||||||
|
|
||||||
M: literal-expected summary
|
M: literal-expected summary
|
||||||
[ "Got a computed value where a " % what>> % " was expected" % ] "" make ;
|
what>> "Got a computed value where a " " was expected" surround ;
|
||||||
|
|
||||||
M: literal-expected error. summary print ;
|
M: literal-expected error. summary print ;
|
||||||
|
|
||||||
|
@ -25,63 +18,45 @@ M: unbalanced-branches-error error.
|
||||||
[ [ first pprint-short bl ] [ second effect>string print ] bi ] each ;
|
[ [ first pprint-short bl ] [ second effect>string print ] bi ] each ;
|
||||||
|
|
||||||
M: too-many->r summary
|
M: too-many->r summary
|
||||||
drop
|
drop "Quotation pushes elements on retain stack without popping them" ;
|
||||||
"Quotation pushes elements on retain stack without popping them" ;
|
|
||||||
|
|
||||||
M: too-many-r> summary
|
M: too-many-r> summary
|
||||||
drop
|
drop "Quotation pops retain stack elements which it did not push" ;
|
||||||
"Quotation pops retain stack elements which it did not push" ;
|
|
||||||
|
|
||||||
M: missing-effect summary
|
M: missing-effect summary
|
||||||
[
|
drop "Missing stack effect declaration" ;
|
||||||
"The word " %
|
|
||||||
word>> name>> %
|
|
||||||
" must declare a stack effect" %
|
|
||||||
] "" make ;
|
|
||||||
|
|
||||||
M: effect-error summary
|
M: effect-error summary
|
||||||
drop "Stack effect declaration is wrong" ;
|
drop "Stack effect declaration is wrong" ;
|
||||||
|
|
||||||
M: recursive-quotation-error error.
|
M: recursive-quotation-error summary
|
||||||
"The quotation " write
|
drop "Recursive quotation" ;
|
||||||
quot>> pprint
|
|
||||||
" calls itself." print
|
|
||||||
"Stack effect inference is undecidable when quotation-level recursion is permitted." print ;
|
|
||||||
|
|
||||||
M: undeclared-recursion-error summary
|
M: undeclared-recursion-error summary
|
||||||
drop
|
word>> name>>
|
||||||
"Inline recursive words must be declared recursive" ;
|
"The inline recursive word " " must be declared recursive" surround ;
|
||||||
|
|
||||||
M: diverging-recursion-error summary
|
M: diverging-recursion-error summary
|
||||||
[
|
word>> name>>
|
||||||
"The recursive word " %
|
"The recursive word " " digs arbitrarily deep into the stack" surround ;
|
||||||
word>> name>> %
|
|
||||||
" digs arbitrarily deep into the stack" %
|
|
||||||
] "" make ;
|
|
||||||
|
|
||||||
M: unbalanced-recursion-error summary
|
M: unbalanced-recursion-error summary
|
||||||
[
|
word>> name>>
|
||||||
"The recursive word " %
|
"The recursive word " " leaves with the stack having the wrong height" surround ;
|
||||||
word>> name>> %
|
|
||||||
" leaves with the stack having the wrong height" %
|
|
||||||
] "" make ;
|
|
||||||
|
|
||||||
M: inconsistent-recursive-call-error summary
|
M: inconsistent-recursive-call-error summary
|
||||||
[
|
word>> name>>
|
||||||
"The recursive word " %
|
"The recursive word "
|
||||||
word>> name>> %
|
" calls itself with a different set of quotation parameters than were input" surround ;
|
||||||
" calls itself with a different set of quotation parameters than were input" %
|
|
||||||
] "" make ;
|
|
||||||
|
|
||||||
M: unknown-primitive-error summary
|
M: unknown-primitive-error summary
|
||||||
drop
|
word>> name>> "The " " word cannot be called from optimized words" surround ;
|
||||||
"Cannot determine stack effect statically" ;
|
|
||||||
|
|
||||||
M: transform-expansion-error summary
|
M: transform-expansion-error summary
|
||||||
drop
|
word>> name>> "Macro expansion of " " threw an error" surround ;
|
||||||
"Compiler transform threw an error" ;
|
|
||||||
|
|
||||||
M: transform-expansion-error error.
|
M: transform-expansion-error error.
|
||||||
[ summary print ]
|
[ summary print ] [ error>> error. ] bi ;
|
||||||
[ "Word: " write word>> . nl ]
|
|
||||||
[ error>> error. ] tri ;
|
M: do-not-compile summary
|
||||||
|
word>> name>> "Cannot compile call to " prepend ;
|
|
@ -1,25 +1,19 @@
|
||||||
! Copyright (C) 2008, 2009 Slava Pestov.
|
! Copyright (C) 2008, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays sequences kernel sequences assocs
|
USING: accessors kernel namespaces stack-checker.recursive-state.tree ;
|
||||||
namespaces stack-checker.recursive-state.tree ;
|
|
||||||
IN: stack-checker.recursive-state
|
IN: stack-checker.recursive-state
|
||||||
|
|
||||||
TUPLE: recursive-state word quotations inline-words ;
|
TUPLE: recursive-state quotations inline-words ;
|
||||||
|
|
||||||
: initial-recursive-state ( word -- state )
|
: <recursive-state> ( -- state ) recursive-state new ; inline
|
||||||
recursive-state new
|
|
||||||
swap >>word
|
|
||||||
f >>quotations
|
|
||||||
f >>inline-words ; inline
|
|
||||||
|
|
||||||
f initial-recursive-state recursive-state set-global
|
<recursive-state> recursive-state set-global
|
||||||
|
|
||||||
: add-local-quotation ( rstate quot -- rstate )
|
: add-local-quotation ( rstate quot -- rstate )
|
||||||
swap clone [ dupd store ] change-quotations ;
|
swap clone [ dupd store ] change-quotations ;
|
||||||
|
|
||||||
: add-inline-word ( word label -- rstate )
|
: add-inline-word ( word label -- rstate )
|
||||||
swap recursive-state get clone
|
swap recursive-state get clone [ store ] change-inline-words ;
|
||||||
[ store ] change-inline-words ;
|
|
||||||
|
|
||||||
: inline-recursive-label ( word -- label/f )
|
: inline-recursive-label ( word -- label/f )
|
||||||
recursive-state get inline-words>> lookup ;
|
recursive-state get inline-words>> lookup ;
|
||||||
|
|
|
@ -2,34 +2,33 @@ IN: tools.errors
|
||||||
USING: help.markup help.syntax source-files.errors words io
|
USING: help.markup help.syntax source-files.errors words io
|
||||||
compiler.errors ;
|
compiler.errors ;
|
||||||
|
|
||||||
ARTICLE: "compiler-errors" "Compiler warnings and errors"
|
ARTICLE: "compiler-errors" "Compiler errors"
|
||||||
"After loading a vocabulary, you might see messages like:"
|
"After loading a vocabulary, you might see a message like:"
|
||||||
{ $code
|
{ $code
|
||||||
":errors - print 2 compiler errors"
|
":errors - print 2 compiler errors"
|
||||||
":warnings - print 1 compiler warnings"
|
|
||||||
}
|
}
|
||||||
"This indicates that some words did not pass the stack checker. Stack checker error conditions are documented in " { $link "inference-errors" } ", and the stack checker itself in " { $link "inference" } "."
|
"This indicates that some words did not pass the stack checker. Stack checker error conditions are documented in " { $link "inference-errors" } ", and the stack checker itself in " { $link "inference" } "."
|
||||||
$nl
|
$nl
|
||||||
"Words to view warnings and errors:"
|
"Words to view errors:"
|
||||||
{ $subsection :warnings }
|
|
||||||
{ $subsection :errors }
|
{ $subsection :errors }
|
||||||
{ $subsection :linkage }
|
{ $subsection :linkage }
|
||||||
"Compiler warnings and errors are reported using the " { $link "tools.errors" } " mechanism, and as a result, they are also are shown in the " { $link "ui.tools.error-list" } "." ;
|
"Compiler errors are reported using the " { $link "tools.errors" } " mechanism, and as a result, they are also are shown in the " { $link "ui.tools.error-list" } "." ;
|
||||||
|
|
||||||
HELP: compiler-error
|
HELP: compiler-error
|
||||||
{ $values { "error" "an error" } { "word" word } }
|
{ $values { "error" compiler-error } { "word" word } }
|
||||||
{ $description "Saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } "." } ;
|
{ $description "Saves the error for viewing with " { $link :errors } "." } ;
|
||||||
|
|
||||||
|
HELP: linkage-error
|
||||||
|
{ $values { "error" linkage-error } { "word" word } }
|
||||||
|
{ $description "Saves the error for viewing with " { $link :linkage } "." } ;
|
||||||
|
|
||||||
HELP: :errors
|
HELP: :errors
|
||||||
{ $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ;
|
{ $description "Prints all compiler errors." } ;
|
||||||
|
|
||||||
HELP: :warnings
|
|
||||||
{ $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ;
|
|
||||||
|
|
||||||
HELP: :linkage
|
HELP: :linkage
|
||||||
{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ;
|
{ $description "Prints all C library interface linkage errors." } ;
|
||||||
|
|
||||||
{ :errors :warnings :linkage } related-words
|
{ :errors :linkage } related-words
|
||||||
|
|
||||||
HELP: errors.
|
HELP: errors.
|
||||||
{ $values { "errors" "a sequence of " { $link source-file-error } " instances" } }
|
{ $values { "errors" "a sequence of " { $link source-file-error } " instances" } }
|
||||||
|
|
|
@ -2,17 +2,15 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: assocs debugger io kernel sequences source-files.errors
|
USING: assocs debugger io kernel sequences source-files.errors
|
||||||
summary accessors continuations make math.parser io.styles namespaces
|
summary accessors continuations make math.parser io.styles namespaces
|
||||||
compiler.errors ;
|
compiler.errors prettyprint ;
|
||||||
IN: tools.errors
|
IN: tools.errors
|
||||||
|
|
||||||
#! Tools for source-files.errors. Used by tools.tests and others
|
#! Tools for source-files.errors. Used by tools.tests and others
|
||||||
#! for error reporting
|
#! for error reporting
|
||||||
|
|
||||||
M: source-file-error compute-restarts
|
M: source-file-error compute-restarts error>> compute-restarts ;
|
||||||
error>> compute-restarts ;
|
|
||||||
|
|
||||||
M: source-file-error error-help
|
M: source-file-error error-help error>> error-help ;
|
||||||
error>> error-help ;
|
|
||||||
|
|
||||||
CONSTANT: +listener-input+ "<Listener input>"
|
CONSTANT: +listener-input+ "<Listener input>"
|
||||||
|
|
||||||
|
@ -20,11 +18,13 @@ M: source-file-error summary
|
||||||
[
|
[
|
||||||
[ file>> [ % ": " % ] [ +listener-input+ % ] if* ]
|
[ file>> [ % ": " % ] [ +listener-input+ % ] if* ]
|
||||||
[ line#>> [ # ] when* ] bi
|
[ line#>> [ # ] when* ] bi
|
||||||
] "" make
|
] "" make ;
|
||||||
;
|
|
||||||
|
|
||||||
M: source-file-error error.
|
M: source-file-error error.
|
||||||
[ summary print nl ] [ error>> error. ] bi ;
|
[ summary print nl ]
|
||||||
|
[ "Asset: " write asset>> short. nl ]
|
||||||
|
[ error>> error. ]
|
||||||
|
tri ;
|
||||||
|
|
||||||
: errors. ( errors -- )
|
: errors. ( errors -- )
|
||||||
group-by-source-file sort-errors
|
group-by-source-file sort-errors
|
||||||
|
@ -34,14 +34,9 @@ M: source-file-error error.
|
||||||
bi*
|
bi*
|
||||||
] assoc-each ;
|
] assoc-each ;
|
||||||
|
|
||||||
: compiler-errors. ( type -- )
|
: :errors ( -- ) compiler-errors get values errors. ;
|
||||||
errors-of-type values errors. ;
|
|
||||||
|
|
||||||
: :errors ( -- ) +compiler-error+ compiler-errors. ;
|
: :linkage ( -- ) linkage-errors get values errors. ;
|
||||||
|
|
||||||
: :warnings ( -- ) +compiler-warning+ compiler-errors. ;
|
|
||||||
|
|
||||||
: :linkage ( -- ) +linkage-error+ compiler-errors. ;
|
|
||||||
|
|
||||||
M: not-compiled summary
|
M: not-compiled summary
|
||||||
word>> name>> "The word " " cannot be executed because it failed to compile" surround ;
|
word>> name>> "The word " " cannot be executed because it failed to compile" surround ;
|
||||||
|
|
|
@ -8,13 +8,12 @@ $nl
|
||||||
{ $heading "Message icons" }
|
{ $heading "Message icons" }
|
||||||
{ $table
|
{ $table
|
||||||
{ "Icon" "Message type" "Reference" }
|
{ "Icon" "Message type" "Reference" }
|
||||||
{ { $image "vocab:ui/tools/error-list/icons/note.tiff" } "Parser note" { $link "parser" } }
|
! { { $image "vocab:ui/tools/error-list/icons/note.tiff" } "Parser note" { $link "parser" } }
|
||||||
{ { $image "vocab:ui/tools/error-list/icons/syntax-error.tiff" } "Syntax error" { $link "syntax" } }
|
! { { $image "vocab:ui/tools/error-list/icons/syntax-error.tiff" } "Syntax error" { $link "syntax" } }
|
||||||
{ { $image "vocab:ui/tools/error-list/icons/compiler-warning.tiff" } "Compiler warning" { $link "compiler-errors" } }
|
|
||||||
{ { $image "vocab:ui/tools/error-list/icons/compiler-error.tiff" } "Compiler error" { $link "compiler-errors" } }
|
{ { $image "vocab:ui/tools/error-list/icons/compiler-error.tiff" } "Compiler error" { $link "compiler-errors" } }
|
||||||
|
{ { $image "vocab:ui/tools/error-list/icons/linkage-error.tiff" } "Linkage error" { $link "loading-libs" } }
|
||||||
{ { $image "vocab:ui/tools/error-list/icons/unit-test-error.tiff" } "Unit test failure" { $link "tools.test" } }
|
{ { $image "vocab:ui/tools/error-list/icons/unit-test-error.tiff" } "Unit test failure" { $link "tools.test" } }
|
||||||
{ { $image "vocab:ui/tools/error-list/icons/help-lint-error.tiff" } "Help lint failure" { $link "help.lint" } }
|
{ { $image "vocab:ui/tools/error-list/icons/help-lint-error.tiff" } "Help lint failure" { $link "help.lint" } }
|
||||||
{ { $image "vocab:ui/tools/error-list/icons/linkage-error.tiff" } "Linkage error" { $link "loading-libs" } }
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
ABOUT: "ui.tools.error-list"
|
ABOUT: "ui.tools.error-list"
|
||||||
|
|
Binary file not shown.
|
@ -110,7 +110,7 @@ HELP: save-location
|
||||||
{ $description "Saves the location of a definition and associates this definition with the current source file." } ;
|
{ $description "Saves the location of a definition and associates this definition with the current source file." } ;
|
||||||
|
|
||||||
HELP: parser-notes
|
HELP: parser-notes
|
||||||
{ $var-description "A boolean controlling whether the parser will print various notes and warnings. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ;
|
{ $var-description "A boolean controlling whether the parser will print various notes. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ;
|
||||||
|
|
||||||
HELP: parser-notes?
|
HELP: parser-notes?
|
||||||
{ $values { "?" "a boolean" } }
|
{ $values { "?" "a boolean" } }
|
||||||
|
@ -260,7 +260,7 @@ HELP: forget-smudged
|
||||||
|
|
||||||
HELP: finish-parsing
|
HELP: finish-parsing
|
||||||
{ $values { "lines" "the lines of text just parsed" } { "quot" "the quotation just parsed" } }
|
{ $values { "lines" "the lines of text just parsed" } { "quot" "the quotation just parsed" } }
|
||||||
{ $description "Records information to the current " { $link file } " and prints warnings about any removed definitions which are still in use." }
|
{ $description "Records information to the current " { $link file } "." }
|
||||||
{ $notes "This is one of the factors of " { $link parse-stream } "." } ;
|
{ $notes "This is one of the factors of " { $link parse-stream } "." } ;
|
||||||
|
|
||||||
HELP: parse-stream
|
HELP: parse-stream
|
||||||
|
|
|
@ -93,7 +93,7 @@ IN: mason.report
|
||||||
load-everything-errors-file
|
load-everything-errors-file
|
||||||
error-dump
|
error-dump
|
||||||
|
|
||||||
"Compiler warnings and errors"
|
"Compiler errors"
|
||||||
compiler-errors-file
|
compiler-errors-file
|
||||||
compiler-error-messages-file
|
compiler-error-messages-file
|
||||||
error-dump
|
error-dump
|
||||||
|
|
Loading…
Reference in New Issue