mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-30 00:35:12 +00:00
fixes #24186 When encountering pragma nodes in templates, if it's a language pragma, we don't process the name, and only any values if they exist. If it's not a language pragma, we process the full node. Previously only the values of colon expressions were processed. To make this simpler, `whichPragma` is patched to consider bracketed hint/warning etc pragmas like `{.hint[HintName]: off.}` as being a pragma of kind `wHint` rather than an invalid pragma which would have to be checked separately. From looking at the uses of `whichPragma` this doesn't seem like it would cause problems. Generics have [the same problem](a27542195c/compiler/semgnrc.nim (L619)) (causing #18649), but to make it work we need to make sure the templates/macros don't get evaluated or get evaluated correctly (i.e. passing the proc node as the final argument), either with #23094 or by completely disabling template/macro evaluation when processing the pragma node, which would also cover `{.pragma.}` templates. (cherry picked from commit911cef1621)