mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
follows up #24871 For subscript assignments, if an overload of `[]=`/`{}=` is not found, the LHS checks for overloads of `[]`/`{}` as a fallback, similar to what field setters do since #24871. This is accomplished by just compiling the LHS if the assignment overloads fail. This has the side effect that the error messages are different now, instead of displaying the overloads of `[]=`/`{}=` that did not match, it will display the ones for `[]`/`{}` instead. This could be fixed by checking for `efLValue` when giving the error messages for `[]`/`{}` but this is not done here. The code for `[]` subscripts is a little different because of the `mArrGet`/`mArrPut` overloads that always match. If the `mArrPut` overload matches without a builtin subscript behavior for the LHS then it calls `semAsgn` again with `mode = noOverloadedSubscript`. Before this meant "fail to compile" but now it means "try to compile the LHS as normal", in both cases the overloads of `[]=` are not considered again.