aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Dybiec <pawel.to.malpa@gmail.com>2020-01-09 18:14:27 +0100
committerPaweł Dybiec <pawel.to.malpa@gmail.com>2020-01-09 18:14:27 +0100
commit7861cacc1d9fa753be8cbbb11b88465acc175cea (patch)
tree17c1eaa8442d103501489bda01ff068e296a6480 /src
parentFix asserts (diff)
Fix infer for deref and arithmetic expressions
Diffstat (limited to 'src')
-rw-r--r--src/Typecheck.hs8
1 files changed, 4 insertions, 4 deletions
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