File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -274,8 +274,10 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
274274 val useCompanion = cls.useCompanionAsSumMirror
275275
276276 def acceptable (tp : Type ): Boolean = tp match
277+ case tp : TermRef => false
278+ case tp : TypeProxy => acceptable(tp.underlying)
277279 case OrType (tp1, tp2) => acceptable(tp1) && acceptable(tp2)
278- case _ => ! tp.termSymbol.isEnumCase && (tp. classSymbol eq cls)
280+ case _ => tp.classSymbol eq cls
279281
280282 if acceptable(mirroredType) && cls.isGenericSum(if useCompanion then cls.linkedClass else ctx.owner) then
281283 val elemLabels = cls.children.map(c => ConstantType (Constant (c.name.toString)))
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ object Singletons {
1616 object B
1717}
1818
19+ type SumOfK1 [F [_]] = Mirror .Sum { type MirroredType [T ] = F [T ] }
20+
21+ class refined extends scala.annotation.RefiningAnnotation
22+
1923object Test {
2024
2125 def main (args : Array [String ]): Unit = {
@@ -24,5 +28,13 @@ object Test {
2428 summon[Mirror .SumOf [Color .Red .type | Color .Green .type ]] // error
2529 summon[Mirror .SumOf [Bar .A | Bar .B ]] // error
2630 summon[Mirror .SumOf [Singletons .A .type | Singletons .B .type ]] // error
31+ summon[SumOfK1 [[X ] =>> Bar ]]
32+ summon[SumOfK1 [[X ] =>> Bar .A | Bar .B ]] // error
33+ summon[SumOfK1 [[X ] =>> (Bar .A | Bar .B ) @ refined]] // error
34+ object opaques {
35+ opaque type Query [X ] = (Bar .A | Bar .B ) @ refined
36+ }
37+ summon[SumOfK1 [opaques.Query ]] // error
38+ summon[SumOfK1 [[X ] =>> (Bar .A @ refined) | Bar .B ]] // error
2739 }
2840}
You can’t perform that action at this time.
0 commit comments