Mark some definitions as global, so as not to capture them.

This commit is contained in:
2020-05-31 00:34:12 -07:00
parent dec6d834f5
commit de08f0febf
6 changed files with 41 additions and 24 deletions

View File

@@ -33,10 +33,10 @@ void typecheck_program(
type_ptr binop_type = type_ptr(new type_arr(
int_type_app,
type_ptr(new type_arr(int_type_app, int_type_app))));
env->bind("+", binop_type);
env->bind("-", binop_type);
env->bind("*", binop_type);
env->bind("/", binop_type);
env->bind("+", binop_type, visibility::global);
env->bind("-", binop_type, visibility::global);
env->bind("*", binop_type, visibility::global);
env->bind("/", binop_type, visibility::global);
std::set<std::string> free;
defs.find_free(mgr, env, free);
@@ -44,7 +44,7 @@ void typecheck_program(
for(auto& pair : defs.env->names) {
std::cout << pair.first << ": ";
pair.second->print(mgr, std::cout);
pair.second.type->print(mgr, std::cout);
std::cout << std::endl;
}
}