Files
Nim/tests/sets/twrongsetmatch.nim
metagn 334848f3ae fix regression with enum types wrongly matching [backport:2.2] (#25010)
fixes #25009

Introduced by #24176, when matching a set type to another, if the given
set is a constructor and the element types match worse than a generic
match (which includes the case with no match), the match is always set
to a convertible match, without checking that it is at least a
convertible match. This is fixed by checking this.
2025-06-21 23:25:04 +02:00

17 lines
207 B
Nim

# issue #25009
type EnumOne {.pure.} = enum
aaa
bbb
type EnumTwo {.pure.} = enum
ccc
ddd
eee
proc doStuff(e: set[EnumOne]) =
echo e
doStuff({EnumTwo.ddd}) #[tt.Error
^ type mismatch]#