diff options
| author | aarne <unknown> | 2004-06-18 13:14:50 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-06-18 13:14:50 +0000 |
| commit | 22613ceb3772722f6e5a5a4470bedd7d6d727474 (patch) | |
| tree | 2453cd1a1811aafe4eb096c77b998a06f4b4262c /src/GF/Compile | |
| parent | 29b9dcaf822e3992eabeac3adaa006e0793409d4 (diff) | |
small things
Diffstat (limited to 'src/GF/Compile')
| -rw-r--r-- | src/GF/Compile/CheckGrammar.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/GF/Compile/CheckGrammar.hs b/src/GF/Compile/CheckGrammar.hs index f7df7102d..c4de7beb1 100644 --- a/src/GF/Compile/CheckGrammar.hs +++ b/src/GF/Compile/CheckGrammar.hs @@ -6,6 +6,7 @@ import Modules import Refresh ---- import TypeCheck +import Values (cPredefAbs) --- import PrGrammar import Lookup @@ -208,9 +209,9 @@ computeLType gr t = do where comp ty = case ty of - Q m _ | m == cPredef -> return ty + Q m c | elem c [cPredef,cPredefAbs] -> return ty - Q m ident -> do + Q m ident -> checkIn ("Q" +++ show m) $ do ty' <- checkErr (lookupResDef gr m ident) if ty' == ty then return ty else comp ty' --- is this necessary to test? @@ -259,7 +260,7 @@ checkReservedId x = let c = prt x in inferLType :: SourceGrammar -> Term -> Check (Term, Type) inferLType gr trm = case trm of - Q m ident | m==cPredef -> termWith trm $ checkErr (typPredefined ident) + Q m ident | isPredef m -> termWith trm $ checkErr (typPredefined ident) Q m ident -> checks [ termWith trm $ checkErr (lookupResType gr m ident) @@ -269,7 +270,7 @@ inferLType gr trm = case trm of prtFail "cannot infer type of constant" trm ] - QC m ident | m==cPredef -> termWith trm $ checkErr (typPredefined ident) + QC m ident | isPredef m -> termWith trm $ checkErr (typPredefined ident) QC m ident -> checks [ termWith trm $ checkErr (lookupResType gr m ident) @@ -402,6 +403,8 @@ inferLType gr trm = case trm of check = checkLType env + isPredef m = elem m [cPredef,cPredefAbs] + justCheck ty te = check ty te >>= return . fst -- for record fields, which may be typed |
