diff --git a/code/compiler/11/definition.cpp b/code/compiler/11/definition.cpp index 79d53af..5f820b7 100644 --- a/code/compiler/11/definition.cpp +++ b/code/compiler/11/definition.cpp @@ -58,7 +58,7 @@ void definition_defn::generate_llvm(llvm_context& ctx) { void definition_data::insert_types(type_env_ptr& env) { this->env = env; - env->bind_type(name, type_ptr(new type_data(name))); + env->bind_type(name, type_ptr(new type_data(name, vars.size()))); } void definition_data::insert_constructors() const { diff --git a/code/compiler/11/parsed_type.cpp b/code/compiler/11/parsed_type.cpp index 4644d52..c69e50a 100644 --- a/code/compiler/11/parsed_type.cpp +++ b/code/compiler/11/parsed_type.cpp @@ -9,6 +9,7 @@ type_ptr parsed_type_app::to_type( if(parent_type == nullptr) throw 0; type_base* base_type; if(!(base_type = dynamic_cast(parent_type.get()))) throw 0; + if(base_type->arity != arguments.size()) throw 0; type_app* new_app = new type_app(std::move(parent_type)); type_ptr to_return(new_app); diff --git a/code/compiler/11/type.hpp b/code/compiler/11/type.hpp index 6c524aa..4583f45 100644 --- a/code/compiler/11/type.hpp +++ b/code/compiler/11/type.hpp @@ -53,8 +53,8 @@ struct type_data : public type_base { std::map constructors; - type_data(std::string n) - : type_base(std::move(n)) {} + type_data(std::string n, int32_t a = 0) + : type_base(std::move(n), a) {} }; struct type_arr : public type {