Get rid of more constructors and make mangled names optional.

This commit is contained in:
2020-09-18 14:09:03 -07:00
parent 56bdbdc6ee
commit 137455b0f4
3 changed files with 13 additions and 8 deletions

View File

@@ -9,10 +9,10 @@ type_ptr parsed_type_app::to_type(
const type_env& e) const {
auto parent_type = e.lookup_type(name);
if(parent_type == nullptr)
throw type_error(std::string("no such type or type constructor ") + name);
throw type_error("no such type or type constructor " + name);
type_base* base_type;
if(!(base_type = dynamic_cast<type_base*>(parent_type.get())))
throw type_error(std::string("invalid type ") + name);
throw type_error("invalid type " + name);
if(base_type->arity != arguments.size()) {
std::ostringstream error_stream;
error_stream << "invalid application of type ";
@@ -34,7 +34,7 @@ type_ptr parsed_type_var::to_type(
const std::set<std::string>& vars,
const type_env& e) const {
if(vars.find(var) == vars.end())
throw type_error(std::string("the type variable ") + var + std::string(" was not explicitly declared."));
throw type_error("the type variable " + var + " was not explicitly declared.");
return type_ptr(new type_var(var));
}