aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lift.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lift.cpp b/src/lift.cpp
index 5791e41..71843b5 100644
--- a/src/lift.cpp
+++ b/src/lift.cpp
@@ -223,14 +223,13 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw()
copy.head->loc = call->loc;
- const AType* copyT = NULL;
-
const ASymbol* sym = call->head()->to_symbol();
if (sym && !cenv.liftStack.empty() && sym->sym() == cenv.name(cenv.liftStack.top().fn)) {
/* Recursive call to innermost function, call implementation directly,
* reusing the current "_me" closure parameter (no cons or .).
*/
copy.push_front(cenv.penv.sym(cenv.liftStack.top().implName));
+ cenv.setTypeSameAs(copy, call);
} else if (is_form(call, "fn")) {
/* Special case: ((fn ...) ...)
* Lifting (fn ...) yields: (Fn _impl ...).
@@ -243,7 +242,7 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw()
const ASymbol* implSym = closure->list_ref(1)->as_symbol();
const AType* implT = cenv.type(cenv.resolve(implSym));
copy.push_front(implSym);
- copyT = implT->list_ref(2)->as_type();
+ cenv.setType(copy, implT->list_ref(2)->as_type());
} else {
// Call to a closure, prepend code to access implementation function
ATuple* getFn = tup<ATuple>(call->loc, cenv.penv.sym("."),
@@ -254,10 +253,9 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw()
const AType* implT = calleeT->list_ref(1)->as_type();
copy.push_front(getFn);
cenv.setType(getFn, implT);
- copyT = implT->list_ref(2)->as_type();
+ cenv.setType(copy, implT->list_ref(2)->as_type());
}
- cenv.setType(copy, copyT);
return copy;
}