Expand description
The structural conformance test and its consumers: x as T, the !
non-null assertion, and the read guard on a narrowed field redeclaration.
Constants§
Functions§
- emit_
cast value as target_ty.checkisSome(shape)when a runtime structural check is needed (the source isn’t a static subtype of the target —unknown/downcasts);Nonefor a statically-proven upcast (repr-only narrow).shapehas interfaces reduced to their object shapes so this walks plain structural types.cast_spanis the cast expression’s own span, mapped while its runtime check is emitted so a limit the check reaches, and a failed check, are reported at the cast rather than at the last part of the value. The code after the cast maps to the enclosing span again.- emit_
narrowed_ field_ read - emit_
non_ null_ assert value!. Converts a runtimenullinto a catchableTypeErrorinstead of relying onref.as_non_null, which would trap.- emit_
non_ null_ assert_ on_ stack !applied to a value already on the stack atsource_ty’s slot — the optional-chain form, where the operand is the step before rather than an expression this can emit itself.- error_
prefix