]> gitweb.factorcode.org Git - factor.git/commitdiff
compile-error-type => source-error-type; make test failures global
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 10 Apr 2009 08:52:12 +0000 (03:52 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 10 Apr 2009 08:52:12 +0000 (03:52 -0500)
15 files changed:
basis/bootstrap/stage2.factor
basis/compiler/codegen/codegen.factor
basis/compiler/compiler.factor
basis/debugger/debugger.factor
basis/editors/editors.factor
basis/stack-checker/errors/errors.factor
basis/tools/errors/errors-docs.factor [new file with mode: 0644]
basis/tools/errors/errors.factor
basis/tools/test/test-docs.factor
basis/tools/test/test.factor
basis/ui/tools/compiler-errors/compiler-errors.factor
basis/ui/tools/debugger/debugger.factor
core/compiler/errors/errors-docs.factor
core/compiler/errors/errors.factor
core/source-files/errors/errors.factor

index 12741f2170fba9dbb826481b26664cabdfc58b11..fd21c9646c710497d79d5107cdc90788e5c68fcb 100644 (file)
@@ -88,7 +88,6 @@ SYMBOL: bootstrap-time
 
         run-bootstrap-init
     ] with-compiler-errors
-    :errors
 
     f error set-global
     f error-continuation set-global
index 65e70bd04228565aa3ae2c39e3c74e5f4d0c56d1..cf1d81fbc277762dcf0ce87ef1545804602fc22e 100755 (executable)
@@ -5,6 +5,7 @@ kernel kernel.private layouts assocs words summary arrays
 combinators classes.algebra alien alien.c-types alien.structs
 alien.strings alien.arrays alien.complex sets libc alien.libraries
 continuations.private fry cpu.architecture
+source-files.errors
 compiler.errors
 compiler.alien
 compiler.cfg
@@ -379,8 +380,7 @@ TUPLE: no-such-library name ;
 M: no-such-library summary
     drop "Library not found" ;
 
-M: no-such-library compiler-error-type
-    drop +linkage+ ;
+M: no-such-library source-file-error-type drop +linkage-error+ ;
 
 : no-such-library ( name -- )
     \ no-such-library boa
@@ -391,8 +391,7 @@ TUPLE: no-such-symbol name ;
 M: no-such-symbol summary
     drop "Symbol not found" ;
 
-M: no-such-symbol compiler-error-type
-    drop +linkage+ ;
+M: no-such-symbol source-file-error-type drop +linkage-error+ ;
 
 : no-such-symbol ( name -- )
     \ no-such-symbol boa
index 04c1a9c55fb9a69033e871f7b818a79ac4337641..2492b6cc230ab8214111489155b4ff079db9ad1f 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel namespaces arrays sequences io words fry
 continuations vocabs assocs dlists definitions math graphs generic
-combinators deques search-deques macros io stack-checker
+combinators deques search-deques macros io source-files.errors stack-checker
 stack-checker.state stack-checker.inlining combinators.short-circuit
 compiler.errors compiler.units compiler.tree.builder
 compiler.tree.optimizer compiler.cfg.builder compiler.cfg.optimizer
@@ -54,7 +54,7 @@ SYMBOLS: +optimized+ +unoptimized+ ;
 
 : ignore-error? ( word error -- ? )
     [ [ inline? ] [ macro? ] bi or ]
-    [ compiler-error-type +warning+ eq? ] bi* and ;
+    [ source-file-error-type +compiler-warning+ eq? ] bi* and ;
 
 : fail ( word error -- * )
     [ 2dup ignore-error? [ 2drop ] [ swap compiler-error ] if ]
index 202cf7eb5ec19d85e21eec585f2c5fd5addd518e..c088b86c3193b1846c0ac1f337bb30e60af53388 100644 (file)
@@ -321,7 +321,7 @@ M: source-file-error error.
         ] bi format nl
     ] [ error>> error. ] bi ;
 
-M: compiler-error summary word>> synopsis ;
+M: compiler-error summary asset>> summary ;
 
 M: bad-effect summary
     drop "Bad stack effect declaration" ;
index 327cdea3c11a10ca4fa6727ad209d5e7a08da521..b494b52c6850ef5c36969f0477a1bf63af6661ee 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: parser lexer kernel namespaces sequences definitions
-io.files io.backend io.pathnames io summary continuations
-tools.crossref tools.vocabs prettyprint source-files assocs
+USING: parser lexer kernel namespaces sequences definitions io.files
+io.backend io.pathnames io summary continuations tools.crossref
+tools.vocabs prettyprint source-files source-files.errors assocs
 vocabs vocabs.loader splitting accessors debugger prettyprint
 help.topics ;
 IN: editors
index 07c26ad100f4490a19290245ab6eaadfba248570..a4d22f8a5bf3acb7dadc82f5ce663cb0e4fc260c 100644 (file)
@@ -2,7 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel generic sequences io words arrays summary effects
 continuations assocs accessors namespaces compiler.errors
-stack-checker.values stack-checker.recursive-state ;
+stack-checker.values stack-checker.recursive-state
+source-files.errors compiler.errors ;
 IN: stack-checker.errors
 
 : pretty-word ( word -- word' )
@@ -10,7 +11,7 @@ IN: stack-checker.errors
 
 TUPLE: inference-error error type word ;
 
-M: inference-error compiler-error-type type>> ;
+M: inference-error source-file-error-type type>> ;
 
 : (inference-error) ( ... class type -- * )
     [ boa ] dip
@@ -18,10 +19,10 @@ M: inference-error compiler-error-type type>> ;
     \ inference-error boa rethrow ; inline
 
 : inference-error ( ... class -- * )
-    +error+ (inference-error) ; inline
+    +compiler-error+ (inference-error) ; inline
 
 : inference-warning ( ... class -- * )
-    +warning+ (inference-error) ; inline
+    +compiler-warning+ (inference-error) ; inline
 
 TUPLE: literal-expected what ;
 
diff --git a/basis/tools/errors/errors-docs.factor b/basis/tools/errors/errors-docs.factor
new file mode 100644 (file)
index 0000000..b66b557
--- /dev/null
@@ -0,0 +1,40 @@
+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 warnings arise from the compiler's stack effect checker. Warnings are non-fatal conditions -- not all code has a static stack effect, so you try to minimize warnings but understand that in many cases they cannot be eliminated. Errors indicate programming mistakes, such as erroneous stack effect declarations."
+$nl
+"The precise warning and error conditions are documented in " { $link "inference-errors" } "."
+$nl
+"Words to view warnings and errors:"
+{ $subsection :errors }
+{ $subsection :warnings }
+{ $subsection :linkage }
+"Words such as " { $link require } " use a combinator which counts errors and prints a report at the end:"
+{ $subsection with-compiler-errors } ;
+
+HELP: compiler-error
+{ $values { "error" "an error" } { "word" word } }
+{ $description "If inside a " { $link with-compiler-errors } ", saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } ". If not inside a " { $link with-compiler-errors } ", ignores the error." } ;
+
+HELP: with-compiler-errors
+{ $values { "quot" quotation } }
+{ $description "Calls the quotation and collects any compiler warnings and errors. Compiler warnings and errors are summarized at the end and can be viewed with " { $link :errors } ", " { $link :warnings } ", and " { $link :linkage } "." }
+{ $notes "Nested calls to " { $link with-compiler-errors } " are ignored, and only the outermost call collects warnings and errors." } ;
+
+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
index 85a29986a60c5217c44e1ea25a11ba9a713fe1b4..4b717a8bdd5f55d3aa926e56a0c94f0ffc057003 100644 (file)
@@ -18,8 +18,8 @@ IN: tools.errors
 : compiler-errors. ( type -- )
     errors-of-type values errors. ;
 
-: :errors ( -- ) +error+ compiler-errors. ;
+: :errors ( -- ) +compiler-error+ compiler-errors. ;
 
-: :warnings ( -- ) +warning+ compiler-errors. ;
+: :warnings ( -- ) +compiler-warning+ compiler-errors. ;
 
-: :linkage ( -- ) +linkage+ compiler-errors. ;
+: :linkage ( -- ) +linkage-error+ compiler-errors. ;
index 7889897c92e06635d03a4467a46fca7f9d1e5c94..06a54f086812c1b557d7d02faca5a67690268d4d 100644 (file)
@@ -14,22 +14,12 @@ ARTICLE: "tools.test.write" "Writing unit tests"
 ARTICLE: "tools.test.run" "Running unit tests"
 "The following words run test harness files; any test failures are collected and printed at the end:"
 { $subsection test }
-{ $subsection test-all } ;
-
-ARTICLE: "tools.test.failure" "Handling test failures"
-"Most of the time the words documented in " { $link "tools.test.run" } " are used because they print all test failures in human-readable form. Some tools inspect the test failures and takes some kind of action instead, for example, " { $vocab-link "mason" } "."
-$nl
-"The following words output an association list mapping vocabulary names to sequences of failures; a failure is an array having the shape " { $snippet "{ error test continuation }" } ", and the elements are as follows:"
-{ $list
-    { { $snippet "error" } " - the error thrown by the unit test" }
-    { { $snippet "test" } " - a pair " { $snippet "{ output input }" } " containing expected output and a unit test quotation which didn't produce this output" }
-    { { $snippet "continuation" } " - the traceback at the point of the error" }
-}
-"The following words run test harness files and output failures:"
-{ $subsection run-tests }
-{ $subsection run-all-tests }
+{ $subsection test-all }
 "The following word prints failures:"
-{ $subsection results. } ;
+{ $subsection :failures }
+"Unit test failurs are instances of a class, and are stored in a global variable:"
+{ $subsection test-failure }
+{ $subsection test-failures } ;
 
 ARTICLE: "tools.test" "Unit testing"
 "A unit test is a piece of code which starts with known input values, then compares the output of a word with an expected output, where the expected output is defined by the word's contract."
@@ -45,8 +35,7 @@ $nl
 $nl
 "If the test harness needs to define words, they should be placed in a vocabulary named " { $snippet { $emphasis "vocab" } ".tests" } " where " { $emphasis "vocab" } " is the vocab being tested."
 { $subsection "tools.test.write" }
-{ $subsection "tools.test.run" }
-{ $subsection "tools.test.failure" } ;
+{ $subsection "tools.test.run" } ;
 
 ABOUT: "tools.test"
 
@@ -78,17 +67,8 @@ HELP: test
 { $values { "prefix" "a vocabulary name" } }
 { $description "Runs unit tests for the vocabulary named " { $snippet "prefix" } " and all of its child vocabularies." } ;
 
-HELP: run-tests
-{ $values { "prefix" "a vocabulary name" } { "failures" "an association list of unit test failures" } }
-{ $description "Runs unit tests for the vocabulary named " { $snippet "prefix" } " and all of its child vocabularies. Outputs unit test failures as documented in " { $link "tools.test.failure" } "." } ;
-
 HELP: test-all
 { $description "Runs unit tests for all loaded vocabularies." } ;
 
-HELP: run-all-tests
-{ $values { "failures" "an association list of unit test failures" } }
-{ $description "Runs unit tests for all loaded vocabularies and outputs unit test failures as documented in " { $link "tools.test.failure" } "." } ;
-
-HELP: results.
-{ $values { "assoc" "an association list of unit test failures" } }
-{ $description "Prints unit test failures output by " { $link run-tests } " or " { $link run-all-tests } " to " { $link output-stream } "." } ;
+HELP: :failures
+{ $description "Prints all pending unit test failures." } ;
index cce3279732147c1e80a43a3d1395f7874664d249..01b6bdbf69e99306d5d4f8eafea02fe78fc7f32d 100644 (file)
@@ -5,13 +5,18 @@ continuations debugger effects fry generalizations io io.files
 io.styles kernel lexer locals macros math.parser namespaces
 parser prettyprint quotations sequences source-files splitting
 stack-checker summary unicode.case vectors vocabs vocabs.loader words
-tools.vocabs tools.errors source-files.errors io.streams.string make ;
+tools.vocabs tools.errors source-files.errors io.streams.string make
+compiler.errors ;
 IN: tools.test
 
-TUPLE: test-failure < source-file-error experiment continuation ;
+TUPLE: test-failure < source-file-error continuation ;
 
-SYMBOL: passed-tests
-SYMBOL: failed-tests
+SYMBOL: +test-failure+
+
+M: test-failure source-file-error-type drop +test-failure+ ;
+
+SYMBOL: test-failures
+test-failures [ V{ } clone ] initialize
 
 <PRIVATE
 
@@ -19,15 +24,13 @@ SYMBOL: failed-tests
     test-failure new
         swap >>line#
         swap >>file
-        swap >>experiment
+        swap >>asset
         swap >>error
         error-continuation get >>continuation ;
 
 : failure ( error experiment file line# -- )
     "--> test failed!" print
-    <test-failure> failed-tests get push ;
-
-: success ( experiment -- ) passed-tests get push ;
+    <test-failure> test-failures get push ;
 
 : file-failure ( error file -- )
     [ f ] [ f ] bi* failure ;
@@ -71,7 +74,7 @@ MACRO: <experiment> ( word -- )
 :: experiment ( word: ( -- error ? ) file line# -- )
     word <experiment> :> e
     e experiment.
-    word execute [ e file line# failure ] [ drop e success ] if ; inline
+    word execute [ e file line# failure ] [ drop ] if ; inline
 
 : parse-test ( accum word -- accum )
     literalize parsed
@@ -90,16 +93,8 @@ SYNTAX: TEST:
 >>
 
 : run-test-file ( path -- )
-    [ run-file ] [ swap file-failure ] recover ;
-
-: collect-results ( quot -- failed passed )
-    [
-        V{ } clone failed-tests set
-        V{ } clone passed-tests set
-        call
-        failed-tests get
-        passed-tests get
-    ] with-scope ; inline
+    [ [ test-failures get ] dip '[ file>> _ = not ] filter-here ]
+    [ [ run-file ] [ swap file-failure ] recover ] bi ;
 
 : run-vocab-tests ( vocab -- )
     dup vocab source-loaded?>> [
@@ -118,30 +113,19 @@ TEST: must-fail-with
 TEST: must-fail
 
 M: test-failure summary
-    [ experiment>> experiment. ] with-string-writer ;
+    [ asset>> experiment. ] with-string-writer ;
 
 M: test-failure error. ( error -- )
     [ call-next-method ]
     [ traceback-button. ]
     bi ;
 
-: results. ( failed passed -- )
-    [
-        [
-            [ length # " tests failed, " % ]
-            [ length # " tests passed." % ]
-            bi*
-        ] "" make nl print nl
-    ] [ drop errors. ] 2bi ;
-
-: run-tests ( prefix -- failed passed )
-    [ child-vocabs [ run-vocab-tests ] each ] collect-results ;
+: :failures ( -- ) test-failures get errors. ;
 
 : test ( prefix -- )
-    run-tests results. ;
-
-: run-all-tests ( -- failed passed )
-    "" run-tests ;
+    [ child-vocabs [ run-vocab-tests ] each ] with-compiler-errors
+    test-failures get [
+        ":failures - show " write length pprint " failing tests." print
+    ] unless-empty ;
 
-: test-all ( -- )
-    run-all-tests results. ;
+: test-all ( -- ) "" test ;
index 44c17a00f42de82c000ab933326d0b34f970023b..91fad986336d2e04cffdfbde8df2100d16d321b8 100644 (file)
@@ -2,14 +2,14 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays sequences sorting assocs colors.constants
 combinators combinators.smart combinators.short-circuit editors
-compiler.errors compiler.units fonts kernel io.pathnames
+compiler.errors compiler.units fonts kernel io.pathnames prettyprint
 stack-checker.errors source-files.errors math.parser math.order models
 models.arrow models.search debugger namespaces summary locals ui
 ui.commands ui.gadgets ui.gadgets.panes ui.gadgets.tables
 ui.gadgets.labeled ui.gadgets.tracks ui.gestures ui.operations
 ui.tools.browser ui.tools.common ui.gadgets.scrollers
 ui.tools.inspector ui.gadgets.status-bar ui.operations
-ui.gadgets.buttons ui.gadgets.borders ui.images ;
+ui.gadgets.buttons ui.gadgets.borders ui.images tools.test ;
 IN: ui.tools.compiler-errors
 
 TUPLE: error-list-gadget < tool source-file error source-file-table error-table error-display ;
@@ -17,7 +17,7 @@ TUPLE: error-list-gadget < tool source-file error source-file-table error-table
 SINGLETON: source-file-renderer
 
 M: source-file-renderer row-columns
-    drop [ first2 length number>string 2array ] [ { "All" "" } ] if* ;
+    drop first2 length number>string 2array ;
 
 M: source-file-renderer row-value
     drop dup [ first <pathname> ] when ;
@@ -30,7 +30,7 @@ M: source-file-renderer column-alignment drop { 0 1 } ;
 M: source-file-renderer filled-column drop 0 ;
 
 : <source-file-model> ( model -- model' )
-    [ values group-by-source-file >alist sort-keys f prefix ] <arrow> ;
+    [ group-by-source-file >alist sort-keys ] <arrow> ;
 
 :: <source-file-table> ( error-list -- table )
     error-list model>> <source-file-model>
@@ -48,36 +48,33 @@ M: source-file-renderer filled-column drop 0 ;
 
 SINGLETON: error-renderer
 
-GENERIC: error-icon ( error -- icon )
-
-: <error-icon> ( name -- image-name )
+: error-icon ( type -- icon )
+    {
+        { +compiler-error+ [ "compiler-error" ] }
+        { +compiler-warning+ [ "compiler-warning" ] }
+        { +linkage-error+ [ "linkage-error" ] }
+        { +test-failure+ [ "unit-test-error" ] }
+    } case
     "vocab:ui/tools/error-list/icons/" ".tiff" surround <image-name> ;
 
-M: compiler-error error-icon
-    compiler-error-type {
-        { +error+ [ "compiler-error" ] }
-        { +warning+ [ "compiler-warning" ] }
-        { +linkage+ [ "linkage-error" ] }
-    } case <error-icon> ;
-
 M: error-renderer row-columns
     drop [
         {
-            [ error-icon ]
+            [ source-file-error-type error-icon ]
             [ line#>> number>string ]
-            [ word>> name>> ]
+            [ asset>> unparse-short ]
             [ error>> summary ]
         } cleave
     ] output>array ;
 
 M: error-renderer prototype-row
-    drop [ "compiler-error" <error-icon> "" "" "" ] output>array ;
+    drop [ +compiler-error+ error-icon "" "" "" ] output>array ;
 
 M: error-renderer row-value
     drop ;
 
 M: error-renderer column-titles
-    drop { "" "Line" "Word" "Error" } ;
+    drop { "" "Line" "Asset" "Error" } ;
 
 M: error-renderer column-alignment drop { 0 1 0 0 } ;
 
@@ -85,8 +82,8 @@ M: error-renderer column-alignment drop { 0 1 0 0 } ;
     [ [ [ file>> ] [ line#>> ] bi 2array ] compare ] sort ;
 
 : <error-table-model> ( error-list -- model )
-    [ model>> [ values ] <arrow> ] [ source-file>> ] bi
-    [ swap { [ drop not ] [ [ string>> ] [ file>> ] bi* = ] } 2|| ] <search>
+    [ model>> ] [ source-file>> ] bi
+    [ [ file>> ] [ string>> ] bi* = ] <search>
     [ sort-errors ] <arrow> ;
 
 :: <error-table> ( error-list -- table )
@@ -161,7 +158,8 @@ SINGLETON: updater
 
 M: updater definitions-changed
     2drop
-    compiler-errors get-global
+    compiler-errors get-global values
+    test-failures get-global append
     compiler-error-model get-global
     set-model ;
 
index e1e176a8c482b2b0d4840198e14155a55b40001a..42666ab0643c82c22e13c9d4ab5dec18225de865 100644 (file)
@@ -8,7 +8,7 @@ ui.gadgets.buttons ui.gadgets.labels ui.gadgets.panes
 ui.gadgets.presentations ui.gadgets.viewports ui.gadgets.tables
 ui.gadgets.tracks ui.gadgets.scrollers ui.gadgets.panes
 ui.gadgets.borders ui.gadgets.status-bar ui.tools.traceback
-ui.tools.inspector ;
+ui.tools.inspector ui.tools.browser ;
 IN: ui.tools.debugger
 
 TUPLE: debugger < track error restarts restart-hook restart-list continuation ;
index 8368afeb19ca47ed9bbb3eb1708ea0ac4236d990..987db582b4edbc8b14b4c8d36bfba179a17a01de 100644 (file)
@@ -2,51 +2,7 @@ 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 warnings arise from the compiler's stack effect checker. Warnings are non-fatal conditions -- not all code has a static stack effect, so you try to minimize warnings but understand that in many cases they cannot be eliminated. Errors indicate programming mistakes, such as erroneous stack effect declarations."
-$nl
-"The precise warning and error conditions are documented in " { $link "inference-errors" } "."
-$nl
-"Words to view warnings and errors:"
-{ $subsection :errors }
-{ $subsection :warnings }
-{ $subsection :linkage }
-"Words such as " { $link require } " use a combinator which counts errors and prints a report at the end:"
-{ $subsection with-compiler-errors } ;
-
 HELP: compiler-errors
 { $var-description "Global variable holding an assoc mapping words to compiler errors. This variable is set by " { $link with-compiler-errors } "." } ;
 
 ABOUT: "compiler-errors"
-
-HELP: compiler-error
-{ $values { "error" "an error" } { "word" word } }
-{ $description "If inside a " { $link with-compiler-errors } ", saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } ". If not inside a " { $link with-compiler-errors } ", ignores the error." } ;
-
-HELP: compiler-error.
-{ $values { "error" "an error" } { "word" word } }
-{ $description "Prints a compiler error to " { $link output-stream } "." } ;
-
-HELP: compiler-errors.
-{ $values { "type" symbol } }
-{ $description "Prints compiler errors to " { $link output-stream } ". The type parameter is one of " { $link +error+ } ", " { $link +warning+ } ", or " { $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
-
-HELP: with-compiler-errors
-{ $values { "quot" quotation } }
-{ $description "Calls the quotation and collects any compiler warnings and errors. Compiler warnings and errors are summarized at the end and can be viewed with " { $link :errors } ", " { $link :warnings } ", and " { $link :linkage } "." }
-{ $notes "Nested calls to " { $link with-compiler-errors } " are ignored, and only the outermost call collects warnings and errors." } ;
index 9d8ab3deab530da6dabe827930a68199b4a30a94..1f02aaf341a6b6cefffd0fb455ad721455f3e90a 100644 (file)
@@ -5,15 +5,11 @@ continuations math math.parser accessors definitions
 source-files.errors ;
 IN: compiler.errors
 
-SYMBOLS: +error+ +warning+ +linkage+ ;
+SYMBOLS: +compiler-error+ +compiler-warning+ +linkage-error+ ;
 
-TUPLE: compiler-error < source-file-error word ;
+TUPLE: compiler-error < source-file-error ;
 
-GENERIC: compiler-error-type ( error -- ? )
-
-M: object compiler-error-type drop +error+ ;
-
-M: compiler-error compiler-error-type error>> compiler-error-type ;
+M: compiler-error source-file-error-type error>> source-file-error-type ;
 
 SYMBOL: compiler-errors
 
@@ -23,7 +19,7 @@ SYMBOL: with-compiler-errors?
 
 : errors-of-type ( type -- assoc )
     compiler-errors get-global
-    swap [ [ nip compiler-error-type ] dip eq? ] curry
+    swap [ [ nip source-file-error-type ] dip eq? ] curry
     assoc-filter ;
 
 : (compiler-report) ( what type word -- )
@@ -40,14 +36,14 @@ SYMBOL: with-compiler-errors?
     ] if ;
 
 : compiler-report ( -- )
-    "semantic errors" +error+ "errors" (compiler-report)
-    "semantic warnings" +warning+ "warnings" (compiler-report)
-    "linkage errors" +linkage+ "linkage" (compiler-report) ;
+    "compiler errors" +compiler-error+ "errors" (compiler-report)
+    "compiler warnings" +compiler-warning+ "warnings" (compiler-report)
+    "linkage errors" +linkage-error+ "linkage" (compiler-report) ;
 
 : <compiler-error> ( error word -- compiler-error )
     \ compiler-error new
         swap
-        [ >>word ]
+        [ >>asset ]
         [ where [ first2 ] [ "<unknown file>" 0 ] if* [ >>file ] [ >>line# ] bi* ] bi
         swap >>error ;
 
index ca7c403609f149ce874cb98a7cf62c4ebe02f2e5..7f19d04f84f56267c7c6df570042ad2f6a173d32 100644 (file)
@@ -3,10 +3,12 @@
 USING: accessors assocs kernel math.order sorting sequences ;
 IN: source-files.errors
 
-TUPLE: source-file-error error file line# ;
+TUPLE: source-file-error error asset file line# ;
 
 : sort-errors ( errors -- alerrors'ist )
     [ [ [ line#>> ] compare ] sort ] { } assoc-map-as sort-keys ;
 
 : group-by-source-file ( errors -- assoc )
     H{ } clone [ [ push-at ] curry [ dup file>> ] prepose each ] keep ;
+
+GENERIC: source-file-error-type ( error -- type )