Skip to content

Commit d717a02

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 161e6ed commit d717a02

File tree

3 files changed

+6
-6
lines changed

3 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Functor[[A >: scala.Nothing <: scala.Any] => scala.collection.immutable.List[A]]
2-
Functor[Const[scala.Int]]
2+
Unapply[[F >: scala.Nothing <: [_$9 >: scala.Nothing <: scala.Any] => scala.Any] => Functor[F], Wrap[scala.Int]]
33
Functor[Id]
44
Functor[[A >: scala.Nothing <: scala.Any] => scala.Option[A]]

tests/run-macros/tasty-simplified/quoted_2.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ object Test {
77
type Id[T] = T
88
case class Wrap[T](t: T)
99

10-
class Dummy
10+
final class Dummy
1111
type Apply[T[_]] = T[Dummy]
1212
type Unapply[F[_[_]], T] = T match {
13-
case Wrap[Apply[a]] => F[a]
1413
case Wrap[Dummy] => F[Id]
14+
case Wrap[Apply[a]] => F[a]
1515
case Wrap[c] => F[Const[c]]
1616
}
1717

0 commit comments

Comments
 (0)