scalus.compiler.sir.lowering.typegens
Members list
Type members
Classlikes
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
Generator for BuiltinValue (CIP-0153 MaryEraValue).
Generator for BuiltinValue (CIP-0153 MaryEraValue).
Unlike BLS12_381_MlResult, BuiltinValue supports Data conversion via valueData/unValueData.
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
DataConstr representation emitter for sum case-class types.
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
- Supertypes
- Self type
-
DataConstrEmitter.type
Type generator for the builtin Data type.
Type generator for the builtin Data type.
Data is a special Plutus type that can represent arbitrary structured data. It has 5 constructors:
- Constr(tag: Integer, args: List[Data])
- Map(pairs: List[(Data, Data)])
- List(elements: List[Data])
- I(value: Integer)
- B(value: ByteString)
Pattern matching on Data requires PlutusV4's Case on Data instruction.
Attributes
- Supertypes
- Self type
-
DataSirTypeGenerator.type
Attributes
- Supertypes
- Self type
-
FunSirTypeGenerator.type
Attributes
- Supertypes
- Self type
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait SirTypeUplcGeneratorclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
Representation is data in pack. Used like Product with have one element wibt name 'toList'
Representation is data in pack. Used like Product with have one element wibt name 'toList'
Attributes
- Supertypes
- Self type
-
PackedDataMapEmitter.type
Attributes
- Supertypes
- Known subtypes
-
object BooleanSirTypeGeneratorobject BuiltinValueSirTypeGeneratorobject ByteStringSirTypeGeneratorobject IntegerSirTypeGeneratorobject StringSirTypeGeneratorShow all
Type generator for BuiltinArray.
Type generator for BuiltinArray.
BuiltinArray is a native UPLC type that holds elements. When used as a field in a case class, it needs to be converted to/from Data representation (Data.List).
Default representation: ProdBuiltinArray(elementRepr) (native UPLC array) Data representation: PackedArrayAsList (Data.List)
Attributes
- Supertypes
- Self type
Emitter for ProductCaseClassRepresentation.ProdBuiltinPair(_, _) scrutinees.
Emitter for ProductCaseClassRepresentation.ProdBuiltinPair(_, _) scrutinees.
Owns the Match shape for a value already in BuiltinPair form: extracts the two components via Case on Pair (V4+) or fstPair/sndPair (V1-V3), binds them in scope, and lowers the case body.
Constr emission for ProdBuiltinPair flows through ProductCaseEmitter.genConstrLowered → ProdDataListOps.genConstr → conversions in ProdDispatch; only the Match path is per-emitter logic.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ProdBuiltinPairOps.type
Emitter for ProductCaseClassRepresentation.ProdDataList and the wider Data-shape product family (ProdDataConstr, PackedDataList, PairIntDataList) — they all share the unConstrData/headList/tailList extraction pattern and converge on ProdDataList for Match.
Emitter for ProductCaseClassRepresentation.ProdDataList and the wider Data-shape product family (ProdDataConstr, PackedDataList, PairIntDataList) — they all share the unConstrData/headList/tailList extraction pattern and converge on ProdDataList for Match.
Owns:
genConstr(Data-list-shaped Constr emission).genSelect(field projection throughProdDataList).genMatch(single-constructor extraction; multi-case input is shrunk viaselectMatchCase, then handed toDataConstrEmitter.genMatchDataConstrCasefor the actual binding + body lowering).
Constructor-handling helpers (retrieveConstrDecl, retrieveConstrIndex, selectMatchCase) still live on ProductCaseEmitter during the Phase 4c migration — they're shared with ProdBuiltinPairOps and several Sum-side typegens.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ProdDataListOps.type
Emitter for ProductCaseClassRepresentation.ProdUplcConstr — native UPLC Constr(tag, [t1, t2, ...]) emission for product values.
Emitter for ProductCaseClassRepresentation.ProdUplcConstr — native UPLC Constr(tag, [t1, t2, ...]) emission for product values.
Owns:
genConstr: adopts each argument to its target field representation (canonical LambdaRepresentation for function fields; the@UplcRepr-annotated repr for annotated fields; the field type's natural repr when the type itself carries a class-level@UplcRepr), then assembles aTerm.Constr-shapedLoweredValuetagged with the constructor's index.hasClassLevelUplcRepr(private helper): unwrapsAnnotated/TypeLambda/TypeProxyand returns true when the underlying(CaseClass | SumCaseClass).decl.annotationscarry theuplcReprkey.
Called from:
ProductCaseEmitter.genConstrLowered(Data-vs-UplcConstr dispatcher);ProductCaseUplcConstrOnlyEmitter,ProductCaseUplcConstrEmitter,SumCaseUplcConstrEmitter,SumCaseUplcConstrOnlyEmitter— all with the same(constr, loweredArgs)signature.
Constructor-handling helpers (retrieveConstrIndex, retrieveConstrDecl) still live on ProductCaseEmitter; called cross-class from here.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ProdUplcConstrOps.type
Product with one element without parent, represented as an element.
Product with one element without parent, represented as an element.
Attributes
- Supertypes
- Self type
-
ProductCaseEmitter.type
Type generator for product case classes annotated with @UplcRepr(UplcConstr).
Type generator for product case classes annotated with @UplcRepr(UplcConstr).
Like ProductCaseUplcConstrOnlyEmitter but for Data-compatible types:
- canBeConvertedToData = true
- defaultDataRepresentation returns DataConstr
- defaultTypeVarRepresentation returns DataConstr
Attributes
- Supertypes
- Self type
Type generator for product case classes that cannot be converted to Data (contain functions or BLS elements). Uses UplcConstr representation.
Type generator for product case classes that cannot be converted to Data (contain functions or BLS elements). Uses UplcConstr representation.
Attributes
- Supertypes
- Self type
Sub-trait for typegens that know how to convert their values to other representations directly — i.e., types whose conversion logic doesn't go through SumDispatch / ProdDispatch. Examples: primitives (Integer, ByteString, ...), Data, Fun, TypeVar, Unit, BLS curve elements, BuiltinValue, BuiltinArray, PackedDataMap.
Sub-trait for typegens that know how to convert their values to other representations directly — i.e., types whose conversion logic doesn't go through SumDispatch / ProdDispatch. Examples: primitives (Integer, ByteString, ...), Data, Fun, TypeVar, Unit, BLS curve elements, BuiltinValue, BuiltinArray, PackedDataMap.
Sum and Prod typegens (DataConstrEmitter, SumCaseUplcConstr*, ProductCase*, OneElementWrapper, SumListEmitter*) extend the base SirTypeUplcGenerator without this sub-trait — their conversions are owned by SumDispatch.toRepresentation / ProdDispatch.toRepresentation and exposed via per-emitter emitConvert methods. Calling toRepresentation on those typegens directly is a compile-time error (no method to call), making the "concentrate Sum/Prod conversion in dispatchers" architectural rule machine-checked.
Attributes
- Supertypes
- Known subtypes
-
object DataSirTypeGeneratorobject FunSirTypeGeneratorobject PackedDataMapEmitterobject BooleanSirTypeGeneratorobject BuiltinValueSirTypeGeneratorobject ByteStringSirTypeGeneratorobject IntegerSirTypeGeneratorobject StringSirTypeGeneratorobject ProdBuiltinArrayEmitterobject TypeNothingSirTypeGeneratorobject TypeVarSirTypeGeneratorobject UnitSirTypeGeneratorShow all
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object DataConstrEmitterclass OneElementWrapperEmitterobject ProductCaseEmitterobject ProductCaseUplcConstrEmitterobject DataSirTypeGeneratorobject FunSirTypeGeneratorobject PackedDataMapEmitterobject BooleanSirTypeGeneratorobject BuiltinValueSirTypeGeneratorobject ByteStringSirTypeGeneratorobject IntegerSirTypeGeneratorobject StringSirTypeGeneratorobject ProdBuiltinArrayEmitterobject TypeNothingSirTypeGeneratorobject TypeVarSirTypeGeneratorobject UnitSirTypeGeneratortrait SumCaseUplcConstrCommonobject SumCaseUplcConstrEmitterobject SumCaseUplcConstrOnlyEmittertrait SumListEmitterCommonclass SumBuiltinListEmitterobject SumPairBuiltinListEmitterShow all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SirTypeUplcGenerator.type
Attributes
- Supertypes
- Self type
Parameterized list type generator for BuiltinList[X] where X is not BuiltinPair. For pair lists, use SumPairBuiltinListEmitter instead.
Parameterized list type generator for BuiltinList[X] where X is not BuiltinPair. For pair lists, use SumPairBuiltinListEmitter instead.
Attributes
- Supertypes
Shared base for the two @UplcRepr(UplcConstr)-driven sum-case generators: SumCaseUplcConstrEmitter (Data-compatible) and SumCaseUplcConstrOnlyEmitter (Fun-bearing, no Data side).
Shared base for the two @UplcRepr(UplcConstr)-driven sum-case generators: SumCaseUplcConstrEmitter (Data-compatible) and SumCaseUplcConstrOnlyEmitter (Fun-bearing, no Data side).
Both lower to SumUplcConstr by default and both promote a ProdUplcConstr value into a single-entry SumUplcConstr parent in upcastOne. Subclasses differ on Data-side surface (defaultDataRepresentation, defaultTypeVarReperesentation, canBeConvertedToData), constructor/select/match emission, and outbound conversion (emitConvert).
Attributes
- Supertypes
- Known subtypes
-
object SumCaseUplcConstrEmitterobject SumCaseUplcConstrOnlyEmitter
Type generator for sum types (enums) annotated with @UplcRepr(UplcConstr).
Type generator for sum types (enums) annotated with @UplcRepr(UplcConstr).
Like SumCaseUplcConstrOnlyEmitter but for Data-compatible types:
- canBeConvertedToData = true
- defaultDataRepresentation returns DataConstr
- defaultTypeVarRepresentation returns DataConstr
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
handle next cases: scalus.cardano.onchain.plutus.prelude.List[A] scalus.uplc.builtin.BuiltinList[A] scalus.cardano.onchain.plutus.prelude.PairList[A, B]
handle next cases: scalus.cardano.onchain.plutus.prelude.List[A] scalus.uplc.builtin.BuiltinList[A] scalus.cardano.onchain.plutus.prelude.PairList[A, B]
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class SumBuiltinListEmitterobject SumPairBuiltinListEmitter
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SumListEmitterCommon.type
Generator for BuiltinList[BuiltinPair[Data,Data]] — pair lists. Uses SumPairBuiltinList representation, serialized via mapData/unMapData.
Generator for BuiltinList[BuiltinPair[Data,Data]] — pair lists. Uses SumPairBuiltinList representation, serialized via mapData/unMapData.
Attributes
- Supertypes
- Self type
Type generator for sum types using UplcConstr representation.
Type generator for sum types using UplcConstr representation.
Handles construction, pattern matching, field selection, and representation conversions for types stored as native UPLC Constr(tag, [fields]).
Used for:
- Types with function/BLS fields (canBeConvertedToData = false)
- Data-compatible types annotated with @UplcRepr("UplcConstr") (canBeConvertedToData = true)
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SumUplcConstrOps.type
throw error on any attempt.
throw error on any attempt.
Attributes
- Supertypes
- Self type
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:
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
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TypeVarOps.type
We assume that type variable can be converted to data, and it is impossible to do something meaningful with it in the UPLC, except pass the value as an argument in unchanged form.
We assume that type variable can be converted to data, and it is impossible to do something meaningful with it in the UPLC, except pass the value as an argument in unchanged form.
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
-
UnitSirTypeGenerator.type