From 4d6994ffde45669bdacce44225ce77df0ed471fa Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Wed, 17 Sep 2014 22:25:08 +0000 Subject: [PATCH] forgot to type check the type of a typed let expression --- src/compiler/GF/Compile/TypeCheck/TC.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compiler/GF/Compile/TypeCheck/TC.hs b/src/compiler/GF/Compile/TypeCheck/TC.hs index 546a346ad..9a3cb7103 100644 --- a/src/compiler/GF/Compile/TypeCheck/TC.hs +++ b/src/compiler/GF/Compile/TypeCheck/TC.hs @@ -134,9 +134,10 @@ checkExp th tenv@(k,rho,gamma) e ty = do Let (x, (mb_typ, e1)) e2 -> do (val,e1,cs1) <- case mb_typ of - Just typ -> do val <- eval rho typ - (e1,cs) <- checkExp th tenv e1 val - return (val,e1,cs) + Just typ -> do (_,cs1) <- checkType th tenv typ + val <- eval rho typ + (e1,cs2) <- checkExp th tenv e1 val + return (val,e1,cs1++cs2) Nothing -> do (e1,val,cs) <- inferExp th tenv e1 return (val,e1,cs) (e2,cs2) <- checkExp th (k,rho,(x,val):gamma) e2 typ @@ -185,9 +186,10 @@ inferExp th tenv@(k,rho,gamma) e = case e of return (ARecType xs, vType, concat css) Let (x, (mb_typ, e1)) e2 -> do (val1,e1,cs1) <- case mb_typ of - Just typ -> do val <- eval rho typ - (e1,cs) <- checkExp th tenv e1 val - return (val,e1,cs) + Just typ -> do (_,cs1) <- checkType th tenv typ + val <- eval rho typ + (e1,cs2) <- checkExp th tenv e1 val + return (val,e1,cs1++cs2) Nothing -> do (e1,val,cs) <- inferExp th tenv e1 return (val,e1,cs) (e2,val2,cs2) <- inferExp th (k,rho,(x,val1):gamma) e2