Seemingly get basic type checking working.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user