diff --git a/src-3.0/GF/Compile/CheckGrammar.hs b/src-3.0/GF/Compile/CheckGrammar.hs index a474637f4..e47496e97 100644 --- a/src-3.0/GF/Compile/CheckGrammar.hs +++ b/src-3.0/GF/Compile/CheckGrammar.hs @@ -336,9 +336,7 @@ computeLType gr t = do where comp ty = case ty of _ | Just _ <- isTypeInts ty -> return ty ---- shouldn't be needed - | ty == typeInt -> return ty ---- shouldn't be needed - | ty == typeFloat -> return ty ---- shouldn't be needed - | ty == typeError -> return ty ---- shouldn't be needed + | isPredefConstant ty -> return ty ---- shouldn't be needed Q m ident -> checkIn ("module" +++ prt m) $ do ty' <- checkErr (lookupResDef gr m ident) @@ -409,14 +407,6 @@ inferLType gr trm = case trm of , checkErr (lookupResDef gr m ident) >>= infer , -{- - do - over <- getOverload gr Nothing trm - case over of - Just trty -> return trty - _ -> prtFail "not overloaded" trm - , --} prtFail "cannot infer type of constant" trm ] diff --git a/src-3.0/GF/Grammar/PrGrammar.hs b/src-3.0/GF/Grammar/PrGrammar.hs index 9867aaef5..1b824da32 100644 --- a/src-3.0/GF/Grammar/PrGrammar.hs +++ b/src-3.0/GF/Grammar/PrGrammar.hs @@ -245,7 +245,7 @@ prRefinement t = case t of prOperSignature :: (QIdent,Type) -> String prOperSignature (f, t) = prQIdent f +++ ":" +++ prt t --- to look up a constant etc in a search tree +-- to look up a constant etc in a search tree --- why here? AR 29/5/2008 lookupIdent :: Ident -> BinTree Ident b -> Err b lookupIdent c t = case lookupTree prt c t of diff --git a/src/GF/Grammar/AppPredefined.hs b/src/GF/Grammar/AppPredefined.hs index fa0048c80..530184c3e 100644 --- a/src/GF/Grammar/AppPredefined.hs +++ b/src/GF/Grammar/AppPredefined.hs @@ -30,7 +30,7 @@ isInPredefined = err (const True) (const False) . typPredefined typPredefined :: Ident -> Err Type typPredefined c@(IC f) = case f of "Int" -> return typePType - "Float" -> return typePType + "Float" -> return typeType "Error" -> return typeType "Ints" -> return $ mkFunType [cnPredef "Int"] typePType "PBool" -> return typePType diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs index 7a48e7c3a..58c449901 100644 --- a/src/GF/Grammar/Macros.hs +++ b/src/GF/Grammar/Macros.hs @@ -307,6 +307,9 @@ isTypeInts ty = case ty of constPredefRes :: String -> Term constPredefRes s = Q (IC "Predef") (zIdent s) +constPredefAbs :: String -> Term +constPredefAbs s = Q (IC "Predef") (zIdent s) + isPredefConstant :: Term -> Bool isPredefConstant t = case t of Q (IC "Predef") _ -> True