diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor index 74768c7443..d6c1876d6a 100644 --- a/basis/bootstrap/stage2.factor +++ b/basis/bootstrap/stage2.factor @@ -4,7 +4,7 @@ USING: accessors init namespaces words words.symbol io kernel.private math memory continuations kernel io.files io.pathnames io.backend system parser vocabs sequences vocabs.loader combinators splitting source-files strings -definitions assocs compiler.errors compiler.units math.parser +definitions assocs compiler.units math.parser generic sets command-line ; IN: bootstrap.stage2 diff --git a/basis/compiler/errors/errors-docs.factor b/basis/compiler/errors/errors-docs.factor index 6dbe5193aa..4d6f014f1b 100644 --- a/basis/compiler/errors/errors-docs.factor +++ b/basis/compiler/errors/errors-docs.factor @@ -2,4 +2,33 @@ IN: compiler.errors USING: help.markup help.syntax vocabs.loader words io quotations words.symbol ; +ARTICLE: "compiler-errors" "Compiler warnings and errors" +"After loading a vocabulary, you might see messages like:" +{ $code + ":errors - print 2 compiler errors" + ":warnings - print 50 compiler warnings" +} +"These messages arise from the compiler's stack effect checker. Production code should not have any warnings and errors in it. Warning and error conditions are documented in " { $link "inference-errors" } "." +$nl +"Words to view warnings and errors:" +{ $subsection :warnings } +{ $subsection :errors } +{ $subsection :linkage } +"Compiler warnings and errors are also shown in the " { $link "ui.tools.error-list" } "." ; + +HELP: compiler-error +{ $values { "error" "an error" } { "word" word } } +{ $description "Saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } "." } ; + +HELP: :errors +{ $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ; + +HELP: :warnings +{ $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ; + +HELP: :linkage +{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ; + +{ :errors :warnings } related-words + ABOUT: "compiler-errors" diff --git a/basis/compiler/errors/errors.factor b/basis/compiler/errors/errors.factor index 7e384d1a71..189e6344e9 100644 --- a/basis/compiler/errors/errors.factor +++ b/basis/compiler/errors/errors.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2007, 2009 Slava Pestov. ! 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 +tools.errors ; IN: compiler.errors TUPLE: compiler-error < source-file-error ; @@ -48,3 +49,12 @@ T{ error-type : compiler-error ( error word -- ) compiler-errors get-global pick [ [ [ ] keep ] dip set-at ] [ delete-at drop ] if ; + +: compiler-errors. ( type -- ) + errors-of-type values errors. ; + +: :errors ( -- ) +compiler-error+ compiler-errors. ; + +: :warnings ( -- ) +compiler-warning+ compiler-errors. ; + +: :linkage ( -- ) +linkage-error+ compiler-errors. ; diff --git a/basis/debugger/debugger.factor b/basis/debugger/debugger.factor index c088b86c31..579ca98c41 100644 --- a/basis/debugger/debugger.factor +++ b/basis/debugger/debugger.factor @@ -8,7 +8,7 @@ classes.mixin classes.tuple continuations continuations.private combinators generic.math classes.builtin classes compiler.units generic.standard vocabs init kernel.private io.encodings accessors math.order destructors source-files parser -classes.tuple.parser effects.parser lexer compiler.errors +classes.tuple.parser effects.parser lexer generic.parser strings.parser vocabs.loader vocabs.parser see source-files.errors ; IN: debugger @@ -321,8 +321,6 @@ M: source-file-error error. ] bi format nl ] [ error>> error. ] bi ; -M: compiler-error summary asset>> summary ; - M: bad-effect summary drop "Bad stack effect declaration" ; diff --git a/basis/tools/errors/errors-docs.factor b/basis/tools/errors/errors-docs.factor index 456f39c041..a28d4abf24 100644 --- a/basis/tools/errors/errors-docs.factor +++ b/basis/tools/errors/errors-docs.factor @@ -1,32 +1 @@ IN: tools.errors -USING: compiler.errors tools.errors help.markup help.syntax vocabs.loader -words quotations io ; - -ARTICLE: "compiler-errors" "Compiler warnings and errors" -"After loading a vocabulary, you might see messages like:" -{ $code - ":errors - print 2 compiler errors" - ":warnings - print 50 compiler warnings" -} -"These messages arise from the compiler's stack effect checker. Production code should not have any warnings and errors in it. Warning and error conditions are documented in " { $link "inference-errors" } "." -$nl -"Words to view warnings and errors:" -{ $subsection :warnings } -{ $subsection :errors } -{ $subsection :linkage } -"Compiler warnings and errors are also shown in the " { $link "ui.tools.error-list" } "." ; - -HELP: compiler-error -{ $values { "error" "an error" } { "word" word } } -{ $description "Saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } "." } ; - -HELP: :errors -{ $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ; - -HELP: :warnings -{ $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ; - -HELP: :linkage -{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ; - -{ :errors :warnings } related-words diff --git a/basis/tools/errors/errors.factor b/basis/tools/errors/errors.factor index 4b717a8bdd..6cf60287d1 100644 --- a/basis/tools/errors/errors.factor +++ b/basis/tools/errors/errors.factor @@ -1,7 +1,6 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs compiler.errors debugger io kernel sequences -source-files.errors ; +USING: assocs debugger io kernel sequences source-files.errors ; IN: tools.errors #! Tools for source-files.errors. Used by tools.tests and others @@ -14,12 +13,3 @@ IN: tools.errors [ [ nl ] [ error. ] interleave ] bi* ] assoc-each ; - -: compiler-errors. ( type -- ) - errors-of-type values errors. ; - -: :errors ( -- ) +compiler-error+ compiler-errors. ; - -: :warnings ( -- ) +compiler-warning+ compiler-errors. ; - -: :linkage ( -- ) +linkage-error+ compiler-errors. ; diff --git a/core/compiler/units/units.factor b/core/compiler/units/units.factor index b5760b8de6..88772caea0 100644 --- a/core/compiler/units/units.factor +++ b/core/compiler/units/units.factor @@ -3,7 +3,7 @@ USING: accessors arrays kernel continuations assocs namespaces sequences words vocabs definitions hashtables init sets math math.order classes classes.algebra classes.tuple -classes.tuple.private generic compiler.errors ; +classes.tuple.private generic ; IN: compiler.units SYMBOL: old-definitions @@ -41,7 +41,7 @@ SYMBOL: compiler-impl HOOK: recompile compiler-impl ( words -- alist ) ! Non-optimizing compiler -M: f recompile [ [ f swap compiler-error ] each ] [ [ f ] { } map>assoc ] bi ; +M: f recompile [ f ] { } map>assoc ; ! Trivial compiler. We don't want to touch the code heap ! during stage1 bootstrap, it would just waste time. diff --git a/core/parser/parser.factor b/core/parser/parser.factor index c4401748cf..38cb4869ab 100644 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -160,6 +160,7 @@ SYMBOL: interactive-vocabs "assocs" "combinators" "compiler" + "compiler.errors" "compiler.units" "continuations" "debugger" @@ -190,7 +191,6 @@ SYMBOL: interactive-vocabs "tools.annotations" "tools.crossref" "tools.disassembler" - "tools.errors" "tools.memory" "tools.profiler" "tools.test"