mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-28 01:38:44 +00:00
new typecheck start
This commit is contained in:
parent
fbe486d25a
commit
7fe9040449
2 changed files with 94 additions and 1 deletions
|
|
@ -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); }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue