mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-28 11:26:39 +00:00
fixes #22844; uses arrays to store holeyenums for iterations; much more efficient than sets and reasonable for holeyenums (#22845)
fixes #22844
This commit is contained in:
@@ -2,6 +2,9 @@ discard """
|
||||
matrix: "--warningAsError:EnumConv --warningAsError:CStringConv"
|
||||
"""
|
||||
|
||||
from std/enumutils import items # missing from the example code
|
||||
from std/sequtils import toSeq
|
||||
|
||||
template reject(x) =
|
||||
static: doAssert(not compiles(x))
|
||||
template accept(x) =
|
||||
@@ -117,4 +120,17 @@ reject:
|
||||
var va = 2
|
||||
var vb = va.Hole
|
||||
|
||||
block: # bug #22844
|
||||
type
|
||||
A = enum
|
||||
a0 = 2
|
||||
a1 = 4
|
||||
a2
|
||||
B[T] = enum
|
||||
b0 = 2
|
||||
b1 = 4
|
||||
|
||||
doAssert A.toSeq == [a0, a1, a2]
|
||||
doAssert B[float].toSeq == [B[float].b0, B[float].b1]
|
||||
|
||||
{.pop.}
|
||||
|
||||
Reference in New Issue
Block a user