summaryrefslogtreecommitdiff
path: root/src/GF/Compile/CheckGrammar.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-09-01 15:11:22 +0000
committeraarne <aarne@cs.chalmers.se>2006-09-01 15:11:22 +0000
commit39a31d07d5c70f490c04da0969716b4bd12bb6ae (patch)
tree2ef660f8e34a3dc8cedf9849a2249d59836868d4 /src/GF/Compile/CheckGrammar.hs
parent04933ef3c9ad381b2d09b7882b4204f6ca53208c (diff)
the Error type; better lexer error reporting
Diffstat (limited to 'src/GF/Compile/CheckGrammar.hs')
-rw-r--r--src/GF/Compile/CheckGrammar.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/GF/Compile/CheckGrammar.hs b/src/GF/Compile/CheckGrammar.hs
index 0359c0679..0ef79123e 100644
--- a/src/GF/Compile/CheckGrammar.hs
+++ b/src/GF/Compile/CheckGrammar.hs
@@ -288,6 +288,7 @@ computeLType gr t = do
App (Q (IC "Predef") (IC "Ints")) _ -> return ty ---- shouldn't be needed
Q (IC "Predef") (IC "Int") -> return ty ---- shouldn't be needed
Q (IC "Predef") (IC "Float") -> return ty ---- shouldn't be needed
+ Q (IC "Predef") (IC "Error") -> return ty ---- shouldn't be needed
Q m c | elem c [cPredef,cPredefAbs] -> return ty
Q m c | elem c [zIdent "Int"] ->
@@ -777,13 +778,16 @@ checkEqLType env t u trm = do
checkWarn $ "WARNING: missing lock field" +++ unwords (map prt lo)
return t'
Bad s -> raise (s +++ "type of" +++ prt trm +++
- ": expected" ++++ prt t' ++++ "inferred" ++++ prt u')
+ ": expected" ++++ prt t' ++++ "inferred" ++++ prt u' ++++ show u')
where
-- t is a subtype of u
--- quick hack version of TC.eqVal
alpha g t u = case (t,u) of
+ -- error (the empty type!) is subtype of any other type
+ (_,Q (IC "Predef") (IC "Error")) -> True
+
-- contravariance
(Prod x a b, Prod y c d) -> alpha g c a && alpha ((x,y):g) b d