TypeVarOps
Cross-cutting helper for TypeVarRepresentation source values (Phase 5, design §3.6). A value carrying TypeVarRepresentation(kind) has bytes in some concrete repr's form; which form depends on kind and the value's underlying SIR type:
Transparent— passthrough; bytes are in whatever form the source produced. Conversion to a concrete target relabels the value as the target repr.Unwrapped— bytes are intp.defaultRepresentationform. Conversion relabels as that underlying repr first, then delegates back to the dispatcher to convert to the target.Fixed— bytes are intp.defaultTypeVarReperesentationform (the type's natural Data-shaped form). Conversion converts to that underlying repr first, then routes to the target.
bridgeFromKind is currently called from SumUplcConstrOps.emitConvert, SumDispatch.sumCaseImpl, OneElementWrapperEmitter.emitConvert, and SumListEmitterCommon.emitConvert.
The companion bridgeToKind handles the symmetric case — concrete source, TypeVar target. Canonical contract: result.representation reflects the actual byte shape (concrete repr the bytes were converted to), NOT the requested TypeVar target — symmetric to bridgeFromKind, which also returns a concrete-repr value rather than wrapping a TypeVar label. Downstream consumers that need the TypeVar label can wrap explicitly. This convention preserves the "honest about byte shape" invariant: .representation always reflects what the bytes actually are, never an abstract claim that may not match.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TypeVarOps.type