mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-23 09:12:48 +00:00
fixes #22775 It's pre-existing that [`prepareOperand` doesn't typecheck expressions which have types](a4f3bf3742/compiler/sigmatch.nim (L2444)). Templates can take typed subscript expressions, transform them into calls to `[]`, and then have this `[]` not be resolved later if the expression is nested inside of a call argument, which leaks an untyped expression past semantic analysis. To prevent this, don't transform any typed subscript expressions into calls to `[]` in templates. Ditto for curly subscripts (with `{}`) and assignments to subscripts and curly subscripts (with `[]=` and `{}=`). (cherry picked from commit62d8ca4306)