Skip to content

Commit 8ee680f

Browse files
Use .superType instead of .underlying
Underlying breaks kinds (the underlying of an AppliedType is a HKTypeLambda). The edited test case was making use of that bug to implement an impossible match type. Indeed, that test is trying to distinguish f[Dummy] (for some f) and Int But there is no way to tell that these two types are disjoint. In fact they are not, since `type F[X] = Any` matches the `f[Dummy]` pattern and overlaps with `Int`.
1 parent 0ef2192 commit 8ee680f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,11 +2508,11 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
25082508
!(tp2 <:< tp1)
25092509
&& (provablyDisjoint(tp1, tp2.tp2) || provablyDisjoint(tp1, tp2.tp1))
25102510
case (tp1: TypeProxy, tp2: TypeProxy) =>
2511-
provablyDisjoint(tp1.underlying, tp2) || provablyDisjoint(tp1, tp2.underlying)
2511+
provablyDisjoint(tp1.superType, tp2) || provablyDisjoint(tp1, tp2.superType)
25122512
case (tp1: TypeProxy, _) =>
2513-
provablyDisjoint(tp1.underlying, tp2)
2513+
provablyDisjoint(tp1.superType, tp2)
25142514
case (_, tp2: TypeProxy) =>
2515-
provablyDisjoint(tp1, tp2.underlying)
2515+
provablyDisjoint(tp1, tp2.superType)
25162516
case _ =>
25172517
false
25182518
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Functor[[A >: scala.Nothing <: scala.Any] => scala.collection.immutable.List[A]]
1+
Functor[Const[scala.collection.immutable.List[Dummy]]]
22
Functor[Const[scala.Int]]
3-
Functor[Id]
4-
Functor[[A >: scala.Nothing <: scala.Any] => scala.Option[A]]
3+
Functor[Const[Dummy]]
4+
Functor[Const[scala.Option[Dummy]]]

0 commit comments

Comments
 (0)