10class Hole :
public Def,
public Setters<Hole> {
63 template<Mode mode>
static bool alpha(
const Def* d1,
const Def* d2) {
70 return Checker(type->world()).assignable_(type, value);
77#ifdef MIM_ENABLE_CHECKS
78 template<Mode>
bool fail();
81 template<Mode>
bool fail() {
return false; }
82 const Def* fail() {
return {}; }
85 template<Mode>
bool alpha_(
const Def* d1,
const Def* d2);
86 template<Mode>
bool alpha_internal(
const Def*,
const Def*);
87 [[nodiscard]]
const Def* assignable_(
const Def* type,
const Def* value);
static const Def * is_uniform(Defs defs)
Yields defs.front(), if all defs are Check::alpha-equivalent (Mode::Test) and nullptr otherwise.
static bool alpha(const Def *d1, const Def *d2)
@ Test
In Mode::Test, no type inference is happening and Holes will not be touched.
@ Check
In Mode::Check, type inference is happening and Holes will be resolved, if possible.
static const Def * assignable(const Def *type, const Def *value)
Can value be assigned to sth of type?
Def * set(size_t i, const Def *)
Successively set from left to right.
World & world() const noexcept
const Def * op(size_t i) const noexcept
const Def * type() const noexcept
Yields the "raw" type of this Def (maybe nullptr).
Def * unset()
Unsets all Def::ops; works even, if not set at all or partially.
Hole * set(const Def *op)
const Def * tuplefy(nat_t)
If unset, explode to Tuple.
static constexpr auto Node
Hole * stub(const Def *type)
static const Def * find(const Def *)
Union-Find to unify Holes.
Hole * stub_(World &, const Def *) override
const Def * rebuild_(World &, const Def *, Defs) const override
CRTP-based Mixin to declare setters for Def::loc & Def::name using a covariant return type.
The World represents the whole program and manages creation of MimIR nodes (Defs).
GIDMap< Def *, To > MutMap