From: Mart Lubbers Date: Wed, 13 Apr 2016 20:37:41 +0000 (+0200) Subject: update X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=1ced60fbbc32f9fcfa47c971a7969c7700d15839;p=cc1516.git update --- 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