@@ -17,7 +17,7 @@ import Eucalypt.Core.Pretty
17
17
import Eucalypt.Core.SourceMap
18
18
import Eucalypt.Core.Syn
19
19
import Eucalypt.Reporting.Classes
20
- import qualified Text.PrettyPrint as T
20
+ import Eucalypt.Reporting.Common
21
21
22
22
data CoreExpShow = forall a . Show a => CoreExpShow (CoreExp a )
23
23
@@ -32,6 +32,7 @@ data CoreError
32
32
| InvalidOperatorSequence CoreExpShow CoreExpShow
33
33
| Bug String CoreExpShow
34
34
| VerifyOperatorsFailed CoreExpShow
35
+ | VerifyNamesFailed CoreExpShow
35
36
| VerifyUnresolvedVar CoreBindingName
36
37
| NoSource
37
38
@@ -41,21 +42,23 @@ instance Show CoreError where
41
42
show (InvalidOperatorOutputStack exprs) = " Invalid output stack while cooking operator soup: [" ++ intercalate " ," (map (\ (CoreExpShow s) -> pprint s) exprs) ++ " ]"
42
43
show (InvalidOperatorSequence (CoreExpShow l) (CoreExpShow r)) = " Invalid sequence of operators:" ++ pprint l ++ " " ++ pprint r
43
44
show (VerifyOperatorsFailed (CoreExpShow expr)) = " Unresolved operator in " ++ pprint expr
45
+ show (VerifyNamesFailed (CoreExpShow expr)) = " Found name nodes, not translated to vars:" ++ pprint expr
44
46
show (VerifyUnresolvedVar name) = " Unresolved variable in " ++ name
45
47
show (Bug message (CoreExpShow expr)) = " BUG! " ++ message ++ " - " ++ pprint expr
46
48
show NoSource = " No source"
47
49
48
50
instance Exception CoreError
49
51
50
52
instance Reportable CoreError where
51
- report = T. text . show
53
+ report = standardReport " CORE ERROR " . show
52
54
53
55
instance HasSourceMapIds CoreError where
54
56
toSourceMapIds (MultipleErrors es) = concatMap toSourceMapIds es
55
57
toSourceMapIds (TooFewOperands op) = toSourceMapIds op
56
58
toSourceMapIds (InvalidOperatorOutputStack exprs) = concatMap toSourceMapIds exprs
57
59
toSourceMapIds (InvalidOperatorSequence l r) = concatMap toSourceMapIds [l, r]
58
60
toSourceMapIds (VerifyOperatorsFailed expr) = toSourceMapIds expr
61
+ toSourceMapIds (VerifyNamesFailed expr) = toSourceMapIds expr
59
62
toSourceMapIds (VerifyUnresolvedVar _) = []
60
63
toSourceMapIds (Bug _ expr) = toSourceMapIds expr
61
64
toSourceMapIds NoSource = []
0 commit comments