From 7861cacc1d9fa753be8cbbb11b88465acc175cea Mon Sep 17 00:00:00 2001 From: Paweł Dybiec Date: Thu, 9 Jan 2020 18:14:27 +0100 Subject: Fix infer for deref and arithmetic expressions --- src/Typecheck.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Typecheck.hs') diff --git a/src/Typecheck.hs b/src/Typecheck.hs index 716f15f..f6621a0 100644 --- a/src/Typecheck.hs +++ b/src/Typecheck.hs @@ -26,19 +26,19 @@ inferExpr (Variant t v e) env = do return t inferExpr (Add e1 e2) env = do checkExpr e1 env TInt - checkExpr e1 env TInt + checkExpr e2 env TInt return TInt inferExpr (Mult e1 e2) env = do checkExpr e1 env TInt - checkExpr e1 env TInt + checkExpr e2 env TInt return TInt inferExpr (Neg e) env = do checkExpr e env TInt return TInt inferExpr (Deref e1) env = do t <- inferExpr e1 env - assertPtr t - return t + tt <- assertPtr t + return tt checkExpr :: Expr -> Environment -> Typ -> Maybe () checkExpr e env t = do -- cgit 1.4.1