File tree 3 files changed +19
-4
lines changed
compiler/src/dotty/tools/dotc/core
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
600
600
compareTypeLambda
601
601
case OrType (tp21, tp22) =>
602
602
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 )
605
604
606
605
// The next clause handles a situation like the one encountered in i2745.scala.
607
606
// We have:
Original file line number Diff line number Diff line change @@ -1102,8 +1102,11 @@ object Types {
1102
1102
}
1103
1103
case _ => tp
1104
1104
}
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
1107
1110
case tp : AndType => tp.tp1.atoms & tp.tp2.atoms
1108
1111
case _ => Set .empty
1109
1112
}
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