diff options
author | metagn <metagngn@gmail.com> | 2024-01-08 05:44:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-08 10:44:04 +0800 |
commit | 00be8f287a41be42b3763f71beecd959dd6b7aa2 (patch) | |
tree | c527452efe89acd94fc6a581f969794820a3330a /tests/cpp/enum.hpp | |
parent | 62d8ca43063197272968b4acf8c7a1ef27874c54 (diff) | |
download | Nim-00be8f287a41be42b3763f71beecd959dd6b7aa2.tar.gz |
trigger range check with new type inference on nkIntLit [backport:1.6] (#23179)
fixes #23177 `changeType` doesn't perform range checks to see if the expression fits the new type [if the old type is the same as the new type](https://github.com/nim-lang/Nim/blob/62d8ca43063197272968b4acf8c7a1ef27874c54/compiler/semexprs.nim#L633). For `nkIntLit`, we previously set the type to the concrete base of the expected type first, then call `changeType`, which works for things like range types but not bare types of smaller bit size like `int8`. Now we don't set the type (so the type is nil), and `changeType` performs the range check when the type is unset (nil).
Diffstat (limited to 'tests/cpp/enum.hpp')
0 files changed, 0 insertions, 0 deletions