SirTypeUplcGenerator

scalus.compiler.sir.lowering.typegens.SirTypeUplcGenerator
See theSirTypeUplcGenerator companion trait

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(tp: SIRType, debug: Boolean = ...)(using lctx: LoweringContext): SirTypeUplcGenerator
def canBeConvertedToData(tp: SIRType)(using LoweringContext): Boolean

Static façades for lctx.typeGenerator(tp).foo(tp) (Phase 6). Let callers stop reaching into the per-type generator instance; future commits can replace the implementation (e.g., direct type-class dispatch) without touching the call sites.

Static façades for lctx.typeGenerator(tp).foo(tp) (Phase 6). Let callers stop reaching into the per-type generator instance; future commits can replace the implementation (e.g., direct type-class dispatch) without touching the call sites.

Attributes

Compute the element representation for a list element type. Note: only BuiltinPair gets ProdBuiltinPair. Tuple2 gets ProdDataConstr via defaultDataRepresentation because Tuple2 is constr-encoded (Data.Constr(0, [fst, snd])), not pair-encoded.

Compute the element representation for a list element type. Note: only BuiltinPair gets ProdBuiltinPair. Tuple2 gets ProdDataConstr via defaultDataRepresentation because Tuple2 is constr-encoded (Data.Constr(0, [fst, snd])), not pair-encoded.

Attributes

def genMatch(matchData: Match, loweredScrutinee: LoweredValue, optTargetType: Option[SIRType])(using LoweringContext): LoweredValue
def genSelect(sel: Select, loweredScrutinee: LoweredValue)(using LoweringContext): LoweredValue
def isPair(tp: SIRType): Boolean
def isPairOrTuple2(tp: SIRType): Boolean
def isPrimitiveElementType(tp: SIRType): Boolean
def resolveFieldRepr(param: TypeBinding, paramType: SIRType)(using lctx: LoweringContext): Option[LoweredValueRepresentation]

Resolve a field's representation from its @UplcRepr annotation.

Resolve a field's representation from its @UplcRepr annotation.

Looks in two places, in order: the field-param's own annotations (param.annotations), and any SIRType.Annotated wrapper on the field's declared type (param.tp). The latter is how List[_] @UplcRepr(UplcConstr) / Option[_] @UplcRepr(UplcConstr) field types express the repr hint — the annotation rides on the type, not on the TypeBinding.

Returns None if no annotation, otherwise resolves the annotation to a concrete LoweredValueRepresentation based on the field's type.

Attributes

Resolve a @UplcRepr annotation SIR value to a concrete LoweredValueRepresentation.

Resolve a @UplcRepr annotation SIR value to a concrete LoweredValueRepresentation.

Handles:

  • String constants (e.g., "UplcConstr", "Data") — type-level repr tags
  • SIR.Constr with args (e.g., SumBuiltinList(UplcConstr)) — parameterized reprs

Attributes

def upcastOne(input: LoweredValue, targetType: SIRType, pos: SIRPosition)(using LoweringContext): LoweredValue