new typecheck start

This commit is contained in:
ProgramSnail 2024-05-01 22:23:44 +03:00
parent fbe486d25a
commit 7fe9040449
2 changed files with 94 additions and 1 deletions

View file

@ -280,7 +280,7 @@ public:
void clear_resolved_generic_names() { resolved_generic_names_.clear(); }
// -- deal with local types
// -- deal with local types // not needed ??
bool add_local_type(const std::string &name);
@ -301,6 +301,21 @@ public:
local_name_typeclasses_.clear();
}
//
enum class UnifyModePolicy { // TODO: proper modes for modifier
Ignore, // all mode differences ignored
ApplyStrongest, // unique > shared, modes changed
CheckLeftIsSubmode, // only check is performed
};
// TODO: next iteration of type check
bool unify(TypeProxy left_proxy, TypeProxy right_proxy,
UnifyModePolicy policy);
bool resolve(TypeProxy generic,
const Type &replacement /* TODO , Mode mode = {}*/);
private:
Type *get_type(size_t id) { return &storage_.at(id); }