Browse Source

Remove unneeded explicit calls to std::string

search
Danila Fedorin 1 year ago
parent
commit
a336b27b6c
  1. 8
      code/compiler/13/ast.cpp

8
code/compiler/13/ast.cpp

@ -47,7 +47,7 @@ type_ptr ast_lid::typecheck(type_mgr& mgr, type_env_ptr& env) {
this->env = env;
type_scheme_ptr lid_type = env->lookup(id);
if(!lid_type)
throw type_error(std::string("unknown identifier ") + id, loc);
throw type_error("unknown identifier " + id, loc);
return lid_type->instantiate(mgr);
}
@ -75,7 +75,7 @@ type_ptr ast_uid::typecheck(type_mgr& mgr, type_env_ptr& env) {
this->env = env;
type_scheme_ptr uid_type = env->lookup(id);
if(!uid_type)
throw type_error(std::string("unknown constructor ") + id, loc);
throw type_error("unknown constructor " + id, loc);
return uid_type->instantiate(mgr);
}
@ -105,7 +105,7 @@ type_ptr ast_binop::typecheck(type_mgr& mgr, type_env_ptr& env) {
type_ptr ltype = left->typecheck(mgr, env);
type_ptr rtype = right->typecheck(mgr, env);
type_ptr ftype = env->lookup(op_name(op))->instantiate(mgr);
if(!ftype) throw type_error(std::string("unknown binary operator ") + op_name(op), loc);
if(!ftype) throw type_error("unknown binary operator " + op_name(op), loc);
// For better type errors, we first require binary function,
// and only then unify each argument. This way, we can
@ -438,7 +438,7 @@ void pattern_constr::find_variables(std::set<std::string>& into) const {
void pattern_constr::typecheck(type_ptr t, type_mgr& mgr, type_env_ptr& env) const {
type_scheme_ptr constructor_type_scheme = env->lookup(constr);
if(!constructor_type_scheme) {
throw type_error(std::string("pattern using unknown constructor ") + constr, loc);
throw type_error("pattern using unknown constructor " + constr, loc);
}
type_ptr constructor_type = constructor_type_scheme->instantiate(mgr);

Loading…
Cancel
Save