Build SumUplcConstr with variant info from the type's DataDecl.
Build SumUplcConstr with variant info from the type's DataDecl.
pos is used in error messages so we can locate the SIR site that triggered the build (otherwise these errors only carry the JVM stack, no SIR file/line context).
Generic N-variant Case dispatch on a SumUplcConstr scrutinee.
Generic N-variant Case dispatch on a SumUplcConstr scrutinee.
Builds Term.Case(scrutinee, [branch_0, branch_1, ...]) where each branch is a nested lambda binding the variant's fields and evaluating the per-variant body. Variant order matches the DataDecl constructor order (tag = position).
The perVariant callback receives (constrIdx, fieldVars). Each fieldVar is an IdentifiableLoweredValue with the variant's field type substituted with the sum's concrete type args, and the field repr from scrutineeRepr.variants(constrIdx).
All per-variant bodies must produce values of outType with outRepr representation — the caller is responsible for any normalization.