File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -600,8 +600,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
600600 compareTypeLambda
601601 case OrType (tp21, tp22) =>
602602 if (tp2.atoms.nonEmpty && canCompare(tp2.atoms))
603- return tp1.atoms.nonEmpty && tp1.atoms.subsetOf(tp2.atoms) ||
604- tp1.isRef(NothingClass )
603+ return tp1.atoms.nonEmpty && tp1.atoms.subsetOf(tp2.atoms) || isSubType(tp1, NothingType )
605604
606605 // The next clause handles a situation like the one encountered in i2745.scala.
607606 // We have:
Original file line number Diff line number Diff line change @@ -1102,8 +1102,11 @@ object Types {
11021102 }
11031103 case _ => tp
11041104 }
1105- Set .empty + normalize(tp)
1106- case tp : OrType => tp.atoms
1105+ val underlyingAtoms = tp.underlying.atoms
1106+ if (underlyingAtoms.isEmpty) Set .empty + normalize(tp)
1107+ else underlyingAtoms
1108+ case tp : ExprType => tp.resType.atoms
1109+ case tp : OrType => tp.atoms // `atoms` overridden in OrType
11071110 case tp : AndType => tp.tp1.atoms & tp.tp2.atoms
11081111 case _ => Set .empty
11091112 }
Original file line number Diff line number Diff line change 1+ object E {
2+ val a : String = ???
3+ val b : String = ???
4+ }
5+
6+ object Test {
7+
8+ val a : E .a.type = E .a
9+ val b : E .b.type = E .b
10+
11+ val c : a.type | b.type = ???
12+ val d : a.type | b.type = c
13+ }
You can’t perform that action at this time.
0 commit comments