UPLC 1.1.0-based lowering from Scalus Intermediate Representation SIR to UPLC scalus.uplc.Term.
We use UPLC version 1.1.0 and generate Sums of Products (SoP) constructors case and constr to represent data types. Also we optimize newtype kind of constructors to be represented as just values.
Value parameters
generateErrorTraces
whether to generate error traces
sir
the Scalus Intermediate Representation to lower
targetLanguage
the target Plutus language version
Attributes
Example
case class Wrapper(a: BigInt)
val x = Wrapper(1) // lowers to just (const integer 1)
The variants are dispatched via the chooseData builtin on every protocol version. The Case instruction is no alternative: it rejects a Data scrutinee before dijkstraPV, and from dijkstraPV on it only scrutinizes Data.Constr, selecting the branch by the constructor tag.
chooseData just selects a delayed branch, it doesn't pass arguments
We bind the scrutinee first, then extract values within each branch