diff options
-rw-r--r-- | src/constrain.cpp | 5 | ||||
-rw-r--r-- | src/tuplr.hpp | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp index bdabc52..6f68b4c 100644 --- a/src/constrain.cpp +++ b/src/constrain.cpp @@ -149,14 +149,13 @@ AFn::constrain(TEnv& tenv, Constraints& c) const at(i)->constrain(tenv, cp); AType* bodyT = tenv.var(at(e-1)); - Subst tsubst = unify(cp); + subst = unify(cp); genericType = tup<AType>(loc, tenv.penv.sym("Fn"), - tsubst.apply(protT), tsubst.apply(bodyT), 0); + subst.apply(protT), subst.apply(bodyT), 0); tenv.genericTypes.insert(make_pair(this, genericType)); Object::pool.addRoot(genericType); tenv.pop(); - subst = tsubst; } AType* t = new AType(*genericType); // FIXME: deep copy diff --git a/src/tuplr.hpp b/src/tuplr.hpp index 541e24b..a76f039 100644 --- a/src/tuplr.hpp +++ b/src/tuplr.hpp @@ -571,7 +571,6 @@ inline ostream& operator<<(ostream& out, const Constraints& c) { struct TEnv : public Env< const ASymbol*, pair<AST*, AType*> > { TEnv(PEnv& p) : penv(p), varID(1) {} AType* fresh(const ASymbol* sym) { - assert(sym); AType* ret = new AType(sym->loc, varID++); def(sym, make_pair((AST*)NULL, ret)); return ret; @@ -579,7 +578,7 @@ struct TEnv : public Env< const ASymbol*, pair<AST*, AType*> > { AType* var(const AST* ast=0) { const ASymbol* sym = ast->to<const ASymbol*>(); if (sym) - return deref(lookup(sym)).second; + return ref(sym)->second; Vars::iterator v = vars.find(ast); if (v != vars.end()) |