Skip to main content

emit_unerase

Function emit_unerase 

Source
pub fn emit_unerase(
    emitter: &mut FunctionEmitter<'_>,
    ctx: &CodegenCtx<'_>,
    ty: &Type,
) -> Result<(), CompilerFailure>
Expand description

Recover ty’s value type from a slot that stores it erased — a box cell’s payload, keyed on slot_value_type.

Skips the cast when the two lowerings already agree — which is not the same as ty not being erased. An erased type often lowers to exactly the (ref null $Object) the cell holds: a TypeVar or GenericParam does, and so does a union mixing one with anything else. Gating on erasure instead would cast a value already in its own lowering — and for an unrecorded ClassRef that cast is a ref.as_non_null plus a ref.cast to a class struct this module never recorded.