File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,8 @@ object DesugarEnums {
172
172
:+ default(ordinal)))
173
173
174
174
if ! enumClass.exists then
175
+ // in the case of a double definition of an enum that only defines class cases (see tests/neg/i4470c.scala)
176
+ // it seems `enumClass` might be `NoSymbol`; in this case we provide no scaffolding.
175
177
Nil
176
178
else
177
179
scaffolding ::: valueCtor ::: fromOrdinal :: Nil
Original file line number Diff line number Diff line change 1
1
object DuplicatedEnum {
2
+
2
3
enum Maybe [+ T ] { // error
3
4
case Some [T ](x : T ) extends Maybe [T ]
4
5
}
5
6
6
7
enum Maybe [+ T ] { // error
7
8
case Some [T ](x : T ) extends Maybe [T ]
8
9
}
10
+
11
+ enum Color { // error
12
+ case Red , Green , Blue
13
+ }
14
+
15
+ enum Color { // error
16
+ case Red , Green , Blue
17
+ }
18
+
19
+ enum Tag [T ] { // error
20
+ case Int extends Tag [Int ]
21
+ case OfClass [T ]()(using val tag : reflect.ClassTag [T ]) extends Tag [T ] // mix order of class and value
22
+ case String extends Tag [String ]
23
+ }
24
+
25
+ enum Tag [T ] { // error
26
+ case Int extends Tag [Int ]
27
+ case OfClass [T ]()(using val tag : reflect.ClassTag [T ]) extends Tag [T ] // mix order of class and value
28
+ case String extends Tag [String ]
29
+ }
30
+
9
31
}
You can’t perform that action at this time.
0 commit comments