fixed PredefAbs in TC

This commit is contained in:
aarne
2004-09-30 06:24:09 +00:00
parent 0dbd3d199c
commit 653c903dc7
2 changed files with 18 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
abstract Imper = PredefAbs ** {
abstract Imper = {
cat
Program ;

View File

@@ -117,7 +117,10 @@ checkInferExp th tenv@(k,_,_) e typ = do
inferExp :: Theory -> TCEnv -> Exp -> Err (AExp, Val, [(Val,Val)])
inferExp th tenv@(k,rho,gamma) e = case e of
Vr x -> mkAnnot (AVr x) $ noConstr $ lookupVar gamma x
Q m c -> mkAnnot (ACn (m,c)) $ noConstr $ lookupConst th (m,c)
Q m c
| m == cPredefAbs && (elem c (map identC ["Int","String"])) ->
return (ACn (m,c) vType, vType, [])
| otherwise -> mkAnnot (ACn (m,c)) $ noConstr $ lookupConst th (m,c)
QC m c -> mkAnnot (ACn (m,c)) $ noConstr $ lookupConst th (m,c) ----
EInt i -> return (AInt i, valAbsInt, [])
K i -> return (AStr i, valAbsString, [])
@@ -132,6 +135,12 @@ inferExp th tenv@(k,rho,gamma) e = case e of
return $ (AApp f' a' b', b', csf ++ csa)
_ -> prtBad ("Prod expected for function" +++ prt f +++ "instead of") typ
_ -> prtBad "cannot infer type of expression" e
where
predefAbs c s = case c of
IC "Int" -> return $ const $ Q cPredefAbs cInt
IC "String" -> return $ const $ Q cPredefAbs cString
_ -> Bad s
checkBranch :: Theory -> TCEnv -> Equation -> Val -> Err (([Exp],AExp),[(Val,Val)])
checkBranch th tenv b@(ps,t) ty = errIn ("branch" +++ show b) $