Only store type in case expression

This commit is contained in:
2020-03-24 17:53:06 -07:00
parent 9e14b2920c
commit addfc2aa55
5 changed files with 24 additions and 101 deletions

View File

@@ -31,22 +31,10 @@ void definition_defn::typecheck_second(type_mgr& mgr, const type_env& env) const
type_it++;
}
type_ptr body_type = body->typecheck_common(mgr, new_env);
type_ptr body_type = body->typecheck(mgr, new_env);
mgr.unify(return_type, body_type);
}
void definition_defn::resolve(const type_mgr& mgr) {
type_var* var;
body->resolve_common(mgr);
return_type = mgr.resolve(return_type, var);
if(var) throw type_error("ambiguously typed program");
for(auto& param_type : param_types) {
param_type = mgr.resolve(param_type, var);
if(var) throw type_error("ambiguously typed program");
}
}
void definition_defn::compile() {
env_ptr new_env = env_ptr(new env_offset(0, nullptr));
for(auto it = params.rbegin(); it != params.rend(); it++) {
@@ -91,10 +79,6 @@ void definition_data::typecheck_second(type_mgr& mgr, const type_env& env) const
// Nothing
}
void definition_data::resolve(const type_mgr& mgr) {
// Nothing
}
void definition_data::compile() {
}