aboutsummaryrefslogtreecommitdiffstats
path: root/typing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'typing.cpp')
-rw-r--r--typing.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/typing.cpp b/typing.cpp
index 4e3fce5..fdea255 100644
--- a/typing.cpp
+++ b/typing.cpp
@@ -152,7 +152,7 @@ ACarCall::constrain(TEnv& tenv) const
{
if (size() != 2) throw Error("`car' requires exactly 1 argument", loc);
at(1)->constrain(tenv);
- AType* carT = tenv.var(loc);
+ AType* carT = tenv.type(this);
AType* pairT = new AType(at(1)->loc, tenv.penv.sym("Pair"), carT, tenv.var(), 0);
tenv.constrain(at(1), pairT);
tenv.constrain(this, carT);
@@ -163,7 +163,7 @@ ACdrCall::constrain(TEnv& tenv) const
{
if (size() != 2) throw Error("`cdr' requires exactly 1 argument", loc);
at(1)->constrain(tenv);
- AType* cdrT = tenv.var(loc);
+ AType* cdrT = tenv.type(this);
AType* pairT = new AType(at(1)->loc, tenv.penv.sym("Pair"), tenv.var(), cdrT, 0);
tenv.constrain(at(1), pairT);
tenv.constrain(this, cdrT);
@@ -240,7 +240,7 @@ TEnv::unify(const Constraints& constraints) // TAPL 22.4
return unify(cp);
} else {
throw Error((format("type is `%1%' but should be `%2%'") % s->str() % t->str()).str(),
- constraints.begin()->loc);
+ s->loc ? s->loc : t->loc);
}
}