summary refs log tree commit diff stats
path: root/tests/misc
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-10-21 00:38:42 +0800
committerGitHub <noreply@github.com>2023-10-20 18:38:42 +0200
commite10878085eaf215a6782cde5c2ea79d4cdf0f40e (patch)
tree74d47dd7bbb24cb3e79e6c8e875731d1efdb3b2c /tests/misc
parent27deacecaadd711cbb5a615abba3237925250616 (diff)
downloadNim-e10878085eaf215a6782cde5c2ea79d4cdf0f40e.tar.gz
fixes #22844; uses arrays to store holeyenums for iterations; much more efficient than sets and reasonable for holeyenums (#22845)
fixes #22844
Diffstat (limited to 'tests/misc')
-rw-r--r--tests/misc/tconv.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/misc/tconv.nim b/tests/misc/tconv.nim
index 5e8eac729..e4a99344a 100644
--- a/tests/misc/tconv.nim
+++ b/tests/misc/tconv.nim
@@ -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.}
8'>18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132