Seemingly get basic type checking working.

This commit is contained in:
2019-06-09 19:51:53 -07:00
parent 1e77622589
commit 711c78e0f6
12 changed files with 249 additions and 5 deletions

View File

@@ -11,12 +11,19 @@ namespace lily {
struct type {
virtual ~type() = default;
virtual bool unify_with(type* other) = 0;
};
struct type_internal : type {
int type_id;
type_internal(int id) : type_id(id) {}
bool unify_with(type* other);
};
struct type_parameter : type {
type* actual_type = nullptr;
bool unify_with(type* other);
};
struct type_data : type {
@@ -31,6 +38,7 @@ namespace lily {
type_data(int id) : type_id(id) {}
constructor* create_constructor(const std::string& name, std::vector<type*>&& params);
bool unify_with(type* other);
};
struct type_func : type {
@@ -39,6 +47,7 @@ namespace lily {
type_func(type* l, type* r) :
left(l), right(r) {}
bool unify_with(type* other);
};
}