fix(ir): lower a built-in number's operator with a foreign right operand as the recorded member #446
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/440-scalar-left-operator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #440
What
lowerArithmetictook the intrinsic as soon as the left operand was a built-in number, so3.0 * serieswith a userextend Float64 with Multiply<Series<Float64>, Series<Float64>>(accepted by the orphan rule, resolved by the checker from the right operand) reached the VM asmultiply.f64on a record. The intrinsic now also needs a built-in number on the right (shifts such asInt << UInt8keep it); anything else goes throughlowerOperator, which reads the checker's recorded resolution.The method form
3.0.multiply(a)was probed with the 0.1.0 toolchain and works; only the operator form was broken. Decision to fix the lowering instead of refusing in the checker: see the refine comment on the issue.Commits
fix(ir): ...: the guard incompiler/src/ir/lower/expression.trbplus the conformance programtests/conformance/scalar-left-operator.trb(Float64andInton the left, a generic type and a plain record on the right, operator and method form side by side, plainFloat64 * Float64/Int * Intunchanged).docs(linear): ...: LINEAR section 6 gives the real reasonscalar * vectoris not provided; TENSOR section 7 records finding 3 as closed by this fix. Noskills/change: these are design records, not in the skills.Seed
No. A guard inside the lowering; no syntax, native, driver flag or std name looked up by string, and
compiler/andstd/use no scalar-left operator on a foreign right operand.Test
Locally only:
torb format --checkon the touched.trbfiles (clean),torb checkof the conformance program (clean), and its expected output taken from the method-form variant under the 0.1.0 toolchain. The operator form, tier A and tier B gates run in forge CI.scalar-left-operator.allocationsis a first guess; the budget is set from the CI count.scalar * valuewith a userMultiplyon the number type lowers as the builtin product #440scalar * valuewith a userMultiplyon the number type lowers as the builtin product #440Approved. Checklist for head
0d96767:scalar-left-operatorcovers Float64 and Int on the left, a generic type and a plain record on the right, operator and method form side by side, and plain Float64Float64 / IntInt unchanged. CI is green for this head (tier A, tier B, gates, pdisc).lowerArithmetictakes the intrinsic only when the right operand is also a built-in number, so shifts likeInt << UInt8keep it. Otherwise it falls through tolowerOperator, which reads the checker's recorded resolution. Text+and the final fall-through are unchanged.Non-blocking:
scalar-left-operator.allocationsis a first-guess budget of 100. Lower it to the real CI count with--update-budgetsin a follow-up, so a regression still fails.Multiply<OtherNumber, ...>still takes the intrinsic. This is an edge case, not part of #440.