File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
273
273
val cls = mirroredType.classSymbol
274
274
val useCompanion = cls.useCompanionAsSumMirror
275
275
276
- if cls.isGenericSum(if useCompanion then cls.linkedClass else ctx.owner) then
276
+ if ( ! mirroredType.termSymbol.isEnumCase && ( cls.isGenericSum(if useCompanion then cls.linkedClass else ctx.owner)) ) then
277
277
val elemLabels = cls.children.map(c => ConstantType (Constant (c.name.toString)))
278
278
279
279
def solve (sym : Symbol ): Type = sym match
Original file line number Diff line number Diff line change
1
+ import scala .util .NotGiven
2
+ import scala .compiletime .*
3
+ import scala .deriving .Mirror
4
+
5
+ enum Color :
6
+ case Red , Green , Blue
7
+ end Color
8
+
9
+ object Test {
10
+
11
+ def main (args : Array [String ]): Unit = {
12
+ summon[Mirror .ProductOf [Color ]] // error
13
+ summon[Mirror .SumOf [Color .Red .type ]] // error
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ import scala .util .NotGiven
2
+ import scala .compiletime .*
3
+ import scala .deriving .Mirror
4
+
5
+ enum Color :
6
+ case Red , Green , Blue
7
+ end Color
8
+
9
+ object Test {
10
+
11
+ def main (args : Array [String ]): Unit = {
12
+ summon[Mirror .Of [Color .Red .type ]]
13
+ summon[Mirror .Of [Color ]]
14
+ summon[Mirror .ProductOf [Color .Red .type ]]
15
+ summon[Mirror .SumOf [Color ]]
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments