diff options
Diffstat (limited to 'typing.cpp')
-rw-r--r-- | typing.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
@@ -228,40 +228,6 @@ APrimitive::constrain(TEnv& tenv, Constraints& c) const } } -void -AConsCall::constrain(TEnv& tenv, Constraints& c) const -{ - THROW_IF(size() != 3, loc, "`cons' requires exactly 2 arguments") - AType* t = new AType(loc, tenv.penv.sym("Pair"), 0); - for (size_t i = 1; i < size(); ++i) { - at(i)->constrain(tenv, c); - t->push_back(tenv.var(at(i))); - } - c.constrain(tenv, this, t); -} - -void -ACarCall::constrain(TEnv& tenv, Constraints& c) const -{ - THROW_IF(size() != 2, loc, "`car' requires exactly 1 argument") - at(1)->constrain(tenv, c); - AType* carT = tenv.var(this); - AType* pairT = new AType(at(1)->loc, tenv.penv.sym("Pair"), carT, tenv.var(), 0); - c.constrain(tenv, at(1), pairT); - c.constrain(tenv, this, carT); -} - -void -ACdrCall::constrain(TEnv& tenv, Constraints& c) const -{ - THROW_IF(size() != 2, loc, "`cdr' requires exactly 1 argument") - at(1)->constrain(tenv, c); - AType* cdrT = tenv.var(this); - AType* pairT = new AType(at(1)->loc, tenv.penv.sym("Pair"), tenv.var(), cdrT, 0); - c.constrain(tenv, at(1), pairT); - c.constrain(tenv, this, cdrT); -} - /*************************************************************************** * Type Inference/Substitution * |