repositories
/
cc1516.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
17a18d0
)
update
author
Mart Lubbers
<mart@martlubbers.net>
Wed, 13 Apr 2016 20:37:41 +0000
(22:37 +0200)
committer
Mart Lubbers
<mart@martlubbers.net>
Wed, 13 Apr 2016 20:37:41 +0000
(22:37 +0200)
sem.icl
patch
|
blob
|
history
diff --git
a/sem.icl
b/sem.icl
index
475d093
..
e894784
100644
(file)
--- 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
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 (
>>| 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)
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 (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
unify t1 t2 = liftT $ Left $ UnifyError zero t1 t2
instance zero Pos where