Skip to content

Commit ef388fb

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 a1edf01 commit ef388fb

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
@@ -2274,11 +2274,11 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
22742274
case (_, tp2: AndType) =>
22752275
provablyDisjoint(tp1, tp2.tp2) || provablyDisjoint(tp1, tp2.tp1)
22762276
case (tp1: TypeProxy, tp2: TypeProxy) =>
2277-
provablyDisjoint(tp1.underlying, tp2) || provablyDisjoint(tp1, tp2.underlying)
2277+
provablyDisjoint(tp1.superType, tp2) || provablyDisjoint(tp1, tp2.superType)
22782278
case (tp1: TypeProxy, _) =>
2279-
provablyDisjoint(tp1.underlying, tp2)
2279+
provablyDisjoint(tp1.superType, tp2)
22802280
case (_, tp2: TypeProxy) =>
2281-
provablyDisjoint(tp1, tp2.underlying)
2281+
provablyDisjoint(tp1, tp2.superType)
22822282
case _ =>
22832283
false
22842284
}
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)