File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -273,19 +273,11 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
273273 val cls = mirroredType.classSymbol
274274 val useCompanion = cls.useCompanionAsSumMirror
275275
276- val isDisjointed = mirroredType match {
277- case OrType (t1, t2) => TypeComparer .provablyDisjoint(t1, t2)
278- case _ => false
279- }
280-
281- def isSumWithSingleton (t : Type ): Boolean = {
282- t match {
283- case OrType (t1, t2) => isSumWithSingleton(t1) || isSumWithSingleton(t2)
284- case _ => t.termSymbol.isEnumCase
285- }
286- }
276+ def acceptable (tp : Type ): Boolean = tp match
277+ case OrType (tp1, tp2) => acceptable(tp1) && acceptable(tp2)
278+ case _ => ! tp.termSymbol.isEnumCase && (tp.classSymbol eq cls)
287279
288- if ( ! isDisjointed && ! isSumWithSingleton( mirroredType) && cls.isGenericSum(if useCompanion then cls.linkedClass else ctx.owner) ) then
280+ if acceptable( mirroredType) && cls.isGenericSum(if useCompanion then cls.linkedClass else ctx.owner) then
289281 val elemLabels = cls.children.map(c => ConstantType (Constant (c.name.toString)))
290282
291283 def solve (sym : Symbol ): Type = sym match
You can’t perform that action at this time.
0 commit comments