DataConstrEmitter
DataConstr representation emitter for sum case-class types.
Owns the DataConstr-specific emission shapes for a Scala 3 sum (sealed-trait + case-class hierarchy lowered to Cardano Constr(tag, [field-data, ...])):
genConstrLowered: forwards to the variant case-class's own typegen (variants live as Prod types that know how to assemble their own bytes).genMatchDataConstr/genMatchDataConstrCase: tag/field extraction viaunConstrData, withlvCaseInteger(V4+) or if-then-else chain (V3) for branch dispatch.upcastOne: synthesizes a parent-sum Constr by reusing the child's bytes under the parent's variant tag.
Pre-Phase-4c-step-3 this was named SumCaseSirTypeGenerator; the rename aligns terminology with the design doc (per-repr emitters at §3.2). prepareCases, findConstructors, and retrieveDataDecl stay here as shared helpers because SumUplcConstrOps and ProductCaseEmitter both reuse them.
Attributes
- Graph
-
- Supertypes
- Self type
-
DataConstrEmitter.type
Members list
Type members
Classlikes
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Attributes
- Definition Classes
Get default representation for data representation of this type. This representation is used when converting to data instrucutres, which holds value as data.
Get default representation for data representation of this type. This representation is used when converting to data instrucutres, which holds value as data.
Attributes
- Definition Classes
Get default representation. Assumed that input parameters of functions and vars and are in this representation.
Get default representation. Assumed that input parameters of functions and vars and are in this representation.
Attributes
- Definition Classes
Get default representation for type variable. This representation is used when converting to parameters of scala functions with type parameters. (Usually the same as defaultDataRepresentation, except Lambdas).
Get default representation for type variable. This representation is used when converting to parameters of scala functions with type parameters. (Usually the same as defaultDataRepresentation, except Lambdas).
Attributes
- Definition Classes
Convert from a DataConstr source to target. TypeVar-source/target handling lives in SumDispatch.sumCaseImpl; the cases below cover every target that fan-out reaches us for. Other shapes are unreachable.
Convert from a DataConstr source to target. TypeVar-source/target handling lives in SumDispatch.sumCaseImpl; the cases below cover every target that fan-out reaches us for. Other shapes are unreachable.
Attributes
Generate constructor for this type — the workhorse, takes pre-lowered arguments. Implementations override this. Always called on DataDecl.tp (or a more specific case-class type for Sum→Product dispatch).
Generate constructor for this type — the workhorse, takes pre-lowered arguments. Implementations override this. Always called on DataDecl.tp (or a more specific case-class type for Sum→Product dispatch).
Value parameters
- constr
-
- constructor SIR node (carries name, decl, parentTypeArgs, anns, tp)
- loweredArgs
-
- already-lowered constructor arguments, in declaration order. Length matches
constr.args.
- already-lowered constructor arguments, in declaration order. Length matches
- optTargetType
-
- optional target type (e.g., for Nil typing where the constr's declared
tpisList[Nothing]).
- optional target type (e.g., for Nil typing where the constr's declared
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Inherited methods
Convenience entry point — pre-lowers constr.args and delegates to genConstrLowered. Use this when the caller hasn't already lowered the arguments; callers that have pre-lowered arguments (like the main lowering driver) should call genConstrLowered directly to avoid double-lowering. Marked final so all dispatch decisions live in genConstrLowered and its overrides.
Convenience entry point — pre-lowers constr.args and delegates to genConstrLowered. Use this when the caller hasn't already lowered the arguments; callers that have pre-lowered arguments (like the main lowering driver) should call genConstrLowered directly to avoid double-lowering. Marked final so all dispatch decisions live in genConstrLowered and its overrides.
Attributes
- Inherited from:
- SirTypeUplcGenerator