Expand description
Implement object-level subtyping.
Functionsยง
- generalize ๐
- Generalize returns a new red-ty created by replacing any generic arguments in
red_tywith fresh inference variables. - propagate_
inverse_ ๐bound - What each upper or lower (depending on
direction) boundBthat is added toinferand add a lower or upper (respectively) boundB1that is implied byB. - reconcile_
ty_ bounds - A task that runs for each type inference variable. It awaits any upper/lower bounds and propagates a corresponding bound.
- require_
assignable_ type - require_
infer_ ๐has_ bound - Return the upper or lower (depending on direction) red-ty-bound from
infer. Ifinferdoes not yet have a suitable bound, create one by generalizingbound. - require_
infer_ ๐sub_ infer - Require that
lower <: upper, where both are type inference variables. This will insert recordupperas an upper bound oflower. Ifupperis a new upper bound, it will begin looping, taking each lower bound oflowerand propagating it toupper(in this case it will not return). - require_
infer_ ๐sub_ ty - Return the red-ty lower bound from
infer, creating one if needed by generalizingbound. Does not relate the return value andboundin any other way. - require_
sub_ red_ terms - require_
sub_ terms - require_
ty_ ๐sub_ infer - Relate
lower_term(not)