diff options
Diffstat (limited to 'src/unify.cpp')
-rw-r--r-- | src/unify.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/unify.cpp b/src/unify.cpp index 1cecfb5..278f3a5 100644 --- a/src/unify.cpp +++ b/src/unify.cpp @@ -129,15 +129,16 @@ unify(const Constraints& constraints) AType::iterator si = s->begin() + 1; AType::iterator ti = t->begin() + 1; for (; si != s->end() && ti != t->end(); ++si, ++ti) { - if ((*si)->str() == "..." || (*ti)->str() == "...") + AType* st = (*si)->as<AType*>(); + AType* tt = (*ti)->as<AType*>(); + if (st->kind == AType::DOTS || tt->kind == AType::DOTS) return unify(cp); - AType* st = (*si)->to<AType*>(); - AType* tt = (*ti)->to<AType*>(); - assert(st && tt); - cp.push_back(Constraint(st, tt, st->loc)); + else + cp.push_back(Constraint(st, tt, st->loc)); } if (si == s->end() && ti == t->end() - || (*ti)->str() == "..." || (*si)->str() == "...") + || (*ti)->as<AType*>()->kind == AType::DOTS + || (*si)->as<AType*>()->kind == AType::DOTS) return unify(cp); } throw Error(s->loc ? s->loc : t->loc, |