You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reading a field off a user operator's result with a scalar operand, (a - 2.0).x, is an internal compiler error #2443
type V { x: f64 }
impl V:
fn sub(self: &Self, rhs: f64) -> V:
V { x: self.x - rhs }
fn main:
let a = V { x: 10.0 }
let t = (a - 2.0).x
print(f"{t}")
error: internal compiler error: invalid MIR before codegen (a bug in the With compiler, not in this program): place _6.f465 projects component 465 of a scalar (ty=14) in `main`
with analyze g51.w audit:resolution names the expression:
violation: resolution: main at g51.w:9:13 node 10856: field base is ty 14 in MIR, ty 222 after Sema's autoderef (field `x`, MIR f64, Sema f64)
So MIR gives a - 2.0 the scalar operand's type (f64) where Sema has V. Each of these works: let r = a - 2.0 then r.x; (a - 2.0).get_x() (a method instead of a field); (a - b).x when sub
takes V. Only a field read directly on an operator-method result whose operands have different types
fails.
It came up with std.math's planned Array, where (a * 2.0).shape style chains are routine.
Checked on Linux x86_64 (WSL2) with release builds of main 14a720bd, d0daedbc (which includes #2396) and e38e86f0.
Fixed on main (b050a01, PR #2587, stack #2588): one commit with the fixture test/behavior/behav_2443_operator_method_result_field.w, which failed before the fix and passes after; battery GREEN on the stack top 077d684 (669 s, pinned seed nightly-20261023-local-1).
Activity
An operator resolved to a method records the method's return as its t…
Six fixes from the issue backlog: #2545, #2524, #2334, #2325, #2443, #…
ehartford commentedon Oct 23, 2026
Fixed on main (b050a01, PR #2587, stack #2588): one commit with the fixture
test/behavior/behav_2443_operator_method_result_field.w, which failed before the fix and passes after; battery GREEN on the stack top 077d684 (669 s, pinned seed nightly-20261023-local-1).