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 {
172172 :+ default(ordinal)))
173173
174174 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.
175177 Nil
176178 else
177179 scaffolding ::: valueCtor ::: fromOrdinal :: Nil
Original file line number Diff line number Diff line change 11object DuplicatedEnum {
2+
23 enum Maybe [+ T ] { // error
34 case Some [T ](x : T ) extends Maybe [T ]
45 }
56
67 enum Maybe [+ T ] { // error
78 case Some [T ](x : T ) extends Maybe [T ]
89 }
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+
931}
You can’t perform that action at this time.
0 commit comments