aboutsummaryrefslogtreecommitdiffstats
path: root/src/unify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/unify.cpp')
-rw-r--r--src/unify.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/unify.cpp b/src/unify.cpp
index 0c9dea2..9f3a521 100644
--- a/src/unify.cpp
+++ b/src/unify.cpp
@@ -33,7 +33,7 @@ TEnv::buildSubst(const AType* genericT, const AType& argsT)
// Build substitution to apply to generic type
const ATuple* genericProtT = genericT->list_ref(1)->as_tuple();
ATuple::const_iterator g = genericProtT->begin();
- AType::const_iterator a = argsT.begin();
+ ATuple::const_iterator a = argsT.begin();
for (; a != argsT.end(); ++a, ++g) {
const AType* genericArgT = (*g)->to_type();
const AType* callArgT = (*a)->to_type();
@@ -60,7 +60,6 @@ Constraints::constrain(TEnv& tenv, const AST* o, const AType* t)
{
assert(o);
assert(t);
- assert(!o->to_type());
push_back(Constraint(tenv.var(o), t));
}
@@ -109,16 +108,12 @@ Constraints::replace(const AType* s, const AType* t)
{
for (Constraints::iterator c = begin(); c != end(); ++c) {
if (*c->first == *s) {
- AType* type = new AType(*t);
- type->loc = c->first->loc;
- c->first = type;
+ c->first = new AType(*t, c->first->loc);
} else if (c->first->kind == AType::EXPR) {
c->first = substitute(c->first, s, t);
}
if (*c->second == *s) {
- AType* type = new AType(*t);
- type->loc = c->second->loc;
- c->second = type;
+ c->second = new AType(*t, c->second->loc);
} else if (c->second->kind == AType::EXPR) {
c->second = substitute(c->second, s, t);
}