aboutsummaryrefslogtreecommitdiff
path: root/frontend/type.icl
diff options
context:
space:
mode:
authorjohnvg2005-11-01 11:43:38 +0000
committerjohnvg2005-11-01 11:43:38 +0000
commit2ca4ad0f34d2b4b47525caad8dfd583c5d8954cf (patch)
tree42204b69fc5ff4f2bbc964f00c9c85388afbf6c1 /frontend/type.icl
parentpass -fusion flag to backend (diff)
fix type error for correct programs using type synonyms with a type variable on the rhs
(see example below) by expanding the type synonym if a type variable is unified with a type synonym that contains that variable. :: Parser b a :== (YieldParser b a) -> (ID b) -> b :: YieldParser b a :== a -> (ID b) -> b :: ID b :== b returnP :: a -> Parser b a returnP x = \yp -> yp x failP :: Parser b a failP = \yp fp -> fp git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1555 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/type.icl')
-rw-r--r--frontend/type.icl24
1 files changed, 13 insertions, 11 deletions
diff --git a/frontend/type.icl b/frontend/type.icl
index e768913..34d5db7 100644
--- a/frontend/type.icl
+++ b/frontend/type.icl
@@ -296,21 +296,23 @@ unifyTypes tv=:(TempV tv_number) attr1 type2 attr2 modules subst heaps
# (type1, subst) = subst![tv_number]
| isIndirection type1
= unifyTypes type1 attr1 type2 attr2 modules subst heaps
- # (succ, subst) = unify_variable_with_type tv_number type2 subst
- = (succ, subst, heaps)
- where
- unify_variable_with_type tv_number1 tv=:(TempV tv_number2) subst
+ = unify_variable_with_type tv_number type2 attr2 subst modules heaps
+ where
+ unify_variable_with_type :: Int Type TypeAttribute *{!Type} TypeInput *TypeHeaps -> (!Bool,!*{!Type},!*TypeHeaps)
+ unify_variable_with_type tv_number1 tv=:(TempV tv_number2) attr subst modules heaps
# (type2, subst) = subst![tv_number2]
| isIndirection type2
- = unify_variable_with_type tv_number type2 subst
+ = unify_variable_with_type tv_number1 type2 attr subst modules heaps
| tv_number1 == tv_number2
- = (True, subst)
- = (True, { subst & [tv_number1] = tv})
- unify_variable_with_type tv_number type subst
+ = (True, subst, heaps)
+ = (True, { subst & [tv_number1] = tv}, heaps)
+ unify_variable_with_type tv_number type attr subst modules heaps
| containsTypeVariable tv_number type subst
- = (False, subst)
-// ---> "unify_variable_with_type"
- = (True, { subst & [tv_number] = type})
+ # (succ, type, heaps) = tryToExpand type attr modules.ti_common_defs heaps
+ | succ
+ = unify_variable_with_type tv_number type attr subst modules heaps
+ = (False, subst, heaps)
+ = (True, { subst & [tv_number] = type},heaps)
unifyTypes type attr1 tv=:(TempV _) attr2 modules subst heaps
= unifyTypes tv attr2 type attr1 modules subst heaps
unifyTypes t1=:(TB tb1) attr1 t2=:(TB tb2) attr2 modules subst heaps