summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-09-17 22:25:08 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-09-17 22:25:08 +0000
commit3ced11580773d36846b138371d484954552bab44 (patch)
treee22b346b8e63f6d6866556d7c94b83ce25c14b21 /src/compiler
parente34d5b04092a001eee3daff696862634a891b935 (diff)
forgot to type check the type of a typed let expression
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/GF/Compile/TypeCheck/TC.hs14
1 files 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