ProdDispatch

scalus.compiler.sir.lowering.ProdDispatch
object ProdDispatch

Dispatch layer for product-typed operations. Single entry point for Prod-side toRepresentation. Routing typegens (ProductCase*, OneElementWrapperEmitter) extend the base SirTypeUplcGenerator only — they don't have toRepresentation at all, so direct calls are compile-time errors. See docs/local/claude/compiler/sum-prod-dispatch-design.md.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def genConstr(constr: Constr, loweredArgs: List[LoweredValue], optTargetType: Option[SIRType])(using lctx: LoweringContext): LoweredValue
def genMatch(matchData: Match, loweredScrutinee: LoweredValue, optTargetType: Option[SIRType])(using lctx: LoweringContext): LoweredValue

Representation-aware dispatch for product-typed genMatch. Mirror of SumDispatch.genMatch:

Representation-aware dispatch for product-typed genMatch. Mirror of SumDispatch.genMatch:

  • (Prod|Sum)UplcConstr → tag-ordered Case via genMatchUplcConstr.
  • ProdDataList / ProdDataConstr / PackedDataList / PairIntDataListProdDataListOps.genMatch (Data-shape extraction via unConstrData + headList/tailList, or just field projection).
  • ProdBuiltinPair(_, _)ProdBuiltinPairOps.genMatch (Case on Pair for V4+, fstPair/sndPair for V1-V3).
  • OneElementWrapper(_) → fall through to the per-type OneElementWrapperEmitter instance — its genMatch captures argType-specific binding extraction.
  • TypeVarRepresentation(_) → relabel to the type's defaultTypeVarRepresentation and recurse.
  • everything else → fall back to the type-keyed typegen's genMatch.

Pre-Phase-4c-step-2 this dispatch was inlined in ProductCaseUplcConstrEmitter.genMatch and ProductCaseEmitter.genMatch; consolidating it here mirrors Phase 4a on the Sum side.

Attributes

def genSelect(sel: Select, loweredScrutinee: LoweredValue)(using lctx: LoweringContext): LoweredValue
def upcastOne(input: LoweredValue, targetType: SIRType, pos: SIRPosition)(using lctx: LoweringContext): LoweredValue