From 1ced60fbbc32f9fcfa47c971a7969c7700d15839 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Wed, 13 Apr 2016 22:37:41 +0200 Subject: [PATCH] update --- sem.icl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sem.icl b/sem.icl index 475d093..e894784 100644 --- a/sem.icl +++ b/sem.icl @@ -57,10 +57,10 @@ semFunDecl fd=:(FunDecl p f args mt vds stmts) = mapM (checkStmt tres) stmts >>= \newstmts-> case mt of Nothing = inferReturnType stmts - >>= \returntype->reconstructType args returntype - >>= \ftype->restoreGamma gamma + >>= \returntype->reconstructType args tres + >>= \ftype->pure Void//restoreGamma gamma >>| putIdent f ftype >>| pure ( - FunDecl p f args (Just ftype) newvds newstmts) + FunDecl p f args (Just ftype) newvds newstmts) Just t = restoreGamma gamma >>| pure (FunDecl p f args mt newvds newstmts) @@ -191,6 +191,7 @@ instance unify Type where unify (ListType t1) (ListType t2) = unify t1 t2 >>| (pure $ ListType t1) unify (ta1 ->> ta2) (tb1 ->> tb2) = unify ta1 tb1 >>= \ta-> unify ta2 tb2 >>= \tb-> pure (ta ->> tb) + unify VoidType VoidType = pure VoidType unify t1 t2 = liftT $ Left $ UnifyError zero t1 t2 instance zero Pos where -- 2.20.1