Problem
Constructor field access reaches the IR as an ObjectProp record projection (ObjectProp (Ref v) (PropName "value0")), not as DataArgumentByIndex. This is what the generated workers actually contain: in the Golden.MaybeChain and Golden.LongMaybeBind IR the bind/maybe/map workers read their scrutinee's payload with ObjectProp … "value0".
Nothing folds that shape. reduceObjectProp folds record literals and updates only (#153), and the case-of-known-constructor folds of #177 cover the DataArgumentByIndex field-read form only. So ObjectProp (K a₀ … aₙ) (PropName "valueᵢ") over a syntactically known, saturated constructor is left standing: (Just 7).value0 does not reduce to 7, even with the constructor in place.
Approach
Extend case-of-known-constructor to the record-projection field read. ObjectProp scrutinee (PropName "valueᵢ"), where scrutinee is a saturated Ctor application, reduces to aᵢ. The label maps to its positional index through the constructor's declared [FieldName] (value0, value1, … are the keys the Lua backend emits for a Ctor). The effect discipline matches the existing DataArgumentByIndex fold: discarded arguments are dropped rather than evaluated or duplicated, and the folded value takes the read node's own annotation, not the argument's (the leak care of #169 and reduceObjectProp).
Prerequisites / Relations
Nothing needs to land first. This is the ObjectProp twin of the DataArgumentByIndex fold in #177 and the algebraic-type companion of the record-literal fold in #153. It is a prerequisite for #180: the dictionary methods inlined there read constructor payloads through exactly this shape.
Verification / Measurement
Standalone impact is near zero, since the shape barely occurs before method inlining lands, so the value shows up through the #180 cascade and is measured end to end by #172. Because the rule touches discard semantics, stress the randomized optimizer specs across seeds.
Problem
Constructor field access reaches the IR as an
ObjectProprecord projection (ObjectProp (Ref v) (PropName "value0")), not asDataArgumentByIndex. This is what the generated workers actually contain: in theGolden.MaybeChainandGolden.LongMaybeBindIR thebind/maybe/mapworkers read their scrutinee's payload withObjectProp … "value0".Nothing folds that shape.
reduceObjectPropfolds record literals and updates only (#153), and the case-of-known-constructor folds of #177 cover theDataArgumentByIndexfield-read form only. SoObjectProp (K a₀ … aₙ) (PropName "valueᵢ")over a syntactically known, saturated constructor is left standing:(Just 7).value0does not reduce to7, even with the constructor in place.Approach
Extend case-of-known-constructor to the record-projection field read.
ObjectProp scrutinee (PropName "valueᵢ"), wherescrutineeis a saturatedCtorapplication, reduces toaᵢ. The label maps to its positional index through the constructor's declared[FieldName](value0,value1, … are the keys the Lua backend emits for aCtor). The effect discipline matches the existingDataArgumentByIndexfold: discarded arguments are dropped rather than evaluated or duplicated, and the folded value takes the read node's own annotation, not the argument's (the leak care of #169 andreduceObjectProp).Prerequisites / Relations
Nothing needs to land first. This is the
ObjectProptwin of theDataArgumentByIndexfold in #177 and the algebraic-type companion of the record-literal fold in #153. It is a prerequisite for #180: the dictionary methods inlined there read constructor payloads through exactly this shape.Verification / Measurement
Standalone impact is near zero, since the shape barely occurs before method inlining lands, so the value shows up through the #180 cascade and is measured end to end by #172. Because the rule touches discard semantics, stress the randomized optimizer specs across seeds.