fix(lower): auto-ref compound lvalues passed to *T params
The implicit address-of that gives `*T` params reference semantics only fired for plain identifiers (`mut(v)`). For a field-access / index / deref lvalue (`make_move(self.board, m)`, `mut(w.s)`), the branch was skipped: the arg was loaded into a temporary and the callee mutated a throwaway copy — silent data loss, with the type check satisfied through the temp so no diagnostic fired. Now compound lvalues auto-ref too: take the real lvalue address via `lowerExprAsPtr`, normalizing the "place" ref to `*T` exactly as `@field_access` does. Mutations through the pointer are now visible to the caller, matching the identifier case. Regression: examples/255-autoref-compound-lvalue.sx.
This commit is contained in:
1
tests/expected/255-autoref-compound-lvalue.exit
Normal file
1
tests/expected/255-autoref-compound-lvalue.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
tests/expected/255-autoref-compound-lvalue.txt
Normal file
1
tests/expected/255-autoref-compound-lvalue.txt
Normal file
@@ -0,0 +1 @@
|
||||
w.s.v = 42
|
||||
Reference in New Issue
Block a user