Rust: Ensure that TPositionalArgumentPosition is large enough for struct expressions

This commit is contained in:
Simon Friis Vindum
2026-03-18 15:02:54 +01:00
parent 6efd844180
commit b8222167d2

View File

@@ -9,7 +9,12 @@ module Impl {
// For the type `FunctionPosition` used by type inference, we work with function-call syntax
// adjusted positions, so a call like `x.m(a, b, c)` needs positions `0` through `3`; for this
// reason, there is no `- 1` after `max(...)` below.
i in [0 .. max([any(ParamList l).getNumberOfParams(), any(ArgList l).getNumberOfArgs()])]
i in [0 .. max([
any(ParamList l).getNumberOfParams(),
any(ArgList l).getNumberOfArgs(),
any(StructFieldList l).getNumberOfFields() // Positions are used for struct expressions in type inference
]
)]
} or
TSelfArgumentPosition() or
TTypeQualifierArgumentPosition()