mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-14 23:53:47 +00:00
The warning gate previously only exempted literal AST nodes (nkCharLit..nkUInt64Lit, nkFloatLit..nkFloat128Lit). Enum constants, named consts, and constant expressions passed through and triggered a spurious ImplicitRangeConversion warning even though the compiler already knows their value and can validate range membership exactly. Replace the literal-kind check with a call to getConstExpr: if the source node folds to a compile-time constant the warning is suppressed. Non-constant values (variables, parameters, runtime expressions) are unaffected and still warn as before. Add tests/range/timplicitrangeconsts.nim to guard the fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>