diff options
Diffstat (limited to 'typing.cpp')
-rw-r--r-- | typing.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -42,7 +42,7 @@ ASymbol::constrain(TEnv& tenv, Constraints& c) const void ATuple::constrain(TEnv& tenv, Constraints& c) const { - AType* t = new AType(loc, NULL); + AType* t = tup<AType>(loc, NULL); FOREACH(const_iterator, p, *this) { (*p)->constrain(tenv, c); t->push_back(tenv.var(*p)); @@ -91,7 +91,7 @@ AFn::constrain(TEnv& tenv, Constraints& c) const Constraints cp; cp.push_back(Constraint(tenv.var(this), tenv.var(), loc)); - AType* protT = new AType(loc, NULL); + AType* protT = tup<AType>(loc, NULL); for (size_t i = 0; i < prot()->size(); ++i) { AType* tvar = tenv.fresh(prot()->at(i)->to<ASymbol*>()); protT->push_back(tvar); @@ -106,7 +106,7 @@ AFn::constrain(TEnv& tenv, Constraints& c) const AType* bodyT = tenv.var(at(e-1)); Subst tsubst = TEnv::unify(cp); - genericType = new AType(loc, tenv.penv.sym("Fn"), + genericType = tup<AType>(loc, tenv.penv.sym("Fn"), tsubst.apply(protT), tsubst.apply(bodyT), 0); tenv.genericTypes.insert(make_pair(this, genericType)); Object::pool.addRoot(genericType); @@ -135,16 +135,16 @@ ACall::constrain(TEnv& tenv, Constraints& c) const for (size_t i = 1; i < size(); ++i) c.constrain(tenv, at(i), gt->second->at(1)->as<ATuple*>()->at(i-1)->as<AType*>()); AType* retT = tenv.var(this); - c.constrain(tenv, at(0), new AType(at(0)->loc, tenv.penv.sym("Fn"), tenv.var(), retT, 0)); + c.constrain(tenv, at(0), tup<AType>(at(0)->loc, tenv.penv.sym("Fn"), tenv.var(), retT, 0)); c.constrain(tenv, this, retT); return; } } - AType* argsT = new AType(loc, NULL); + AType* argsT = tup<AType>(loc, 0); for (size_t i = 1; i < size(); ++i) argsT->push_back(tenv.var(at(i))); AType* retT = tenv.var(); - c.constrain(tenv, at(0), new AType(at(0)->loc, tenv.penv.sym("Fn"), argsT, retT, 0)); + c.constrain(tenv, at(0), tup<AType>(at(0)->loc, tenv.penv.sym("Fn"), argsT, retT, 0)); c.constrain(tenv, this, retT); } |