summary refs log tree commit diff stats
path: root/compiler/semstrictfuncs.nim
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2024-08-27 10:58:05 +0300
committerGitHub <noreply@github.com>2024-08-27 09:58:05 +0200
commitf09c549d42f477866bfa72a902d6b43f85959e8f (patch)
treec37b40beb8fc71449b600949a2d99a3b9b406ca2 /compiler/semstrictfuncs.nim
parent7e88091de3f067675f20f36052a1b9c7c603e47a (diff)
downloadNim-f09c549d42f477866bfa72a902d6b43f85959e8f.tar.gz
make int literals with range type match their base type better than other int types (#24017)
This is a very niche case encountered in #24012, where an int literal
got a `range` type as a result of a generic instantiation (in
`tgenericcomputedrange`), I can't think of another test case. The base
type of the range being `int` made it match `int` with `isSubrange` as
in the first `if` branch, but other int types like `int32` matched with
`isFromIntLit` which is a better match.

Instead, int literals with range type now:

1. match their base type with `isFromIntLit`,
2. don't match other int types with `isFromIntLit`, instead giving
`isConvertible` as in the last `if` branch in `handleRange`.
Diffstat (limited to 'compiler/semstrictfuncs.nim')
0 files changed, 0 insertions, 0 deletions