summaryrefslogtreecommitdiff
path: root/src/GF/Compile/CheckGrammar.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-11-18 20:54:10 +0000
committeraarne <aarne@cs.chalmers.se>2006-11-18 20:54:10 +0000
commit9d1cc0728494d5887fb95af0ef0b326b38ddb530 (patch)
treedae0396042bf0f2c967ffb3ca48f8ef7216b4ce8 /src/GF/Compile/CheckGrammar.hs
parent8e07d61ccfe67fb72253d3ce622f8eff7342a427 (diff)
normalize record types in overload resolution
Diffstat (limited to 'src/GF/Compile/CheckGrammar.hs')
-rw-r--r--src/GF/Compile/CheckGrammar.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/GF/Compile/CheckGrammar.hs b/src/GF/Compile/CheckGrammar.hs
index cb8c40e5f..76ff093f3 100644
--- a/src/GF/Compile/CheckGrammar.hs
+++ b/src/GF/Compile/CheckGrammar.hs
@@ -339,9 +339,13 @@ computeLType gr t = do
r' <- comp r
s' <- comp s
case (r',s') of
- (RecType rs, RecType ss) -> checkErr $ plusRecType r' s'
+ (RecType rs, RecType ss) -> checkErr (plusRecType r' s') >>= comp
_ -> return $ ExtR r' s'
+ RecType fs -> do
+ let fs' = sortBy (\x y -> compare (fst x) (fst y)) fs
+ liftM RecType $ mapPairsM comp fs'
+
_ | isPredefConstant ty -> return ty
_ -> composOp comp ty
@@ -585,8 +589,8 @@ inferLType gr trm = case trm of
_ -> raise $ "no overload instance of" +++ prt f +++
"for" +++ unwords (map prtType tys) +++ "among" ++++
unlines [unwords (map prtType ty) | (ty,_) <- typs]
- ++++ "DEBUG" +++ unwords (map show tys) +++ ";" ++++
- unlines (map (show . fst) typs) ----
+ ++++ "DEBUG" +++ unwords (map show tys) +++ ";"
+ ++++ unlines (map (show . fst) typs) ----
lookupOverloadInstance tys typs = lookup tys typs ---- use Map
@@ -822,8 +826,10 @@ 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" ++++ prtType t' ++++
- "inferred" ++++ prtType u' ++++ show u')
+ ": expected:" +++ prtType t' ++++
+ "inferred:" +++ prtType u'
+ ---- +++++ "DEBUG:" ++++ show t' ++++ show u'
+ )
where
-- t is a subtype of u