diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index de40ac7232b7..ff432ee6ce81 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -2828,6 +2828,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling provablyDisjoint(tp1, defn.AnyType) case _ if !ctx.erasedTypes && tp1.isFromJavaObject => provablyDisjoint(defn.AnyType, tp2) + case (tp1: TypeRef, _) if tp1.symbol == defn.AnyKindClass => + false + case (_, tp2: TypeRef) if tp2.symbol == defn.AnyKindClass => + false case (tp1: TypeRef, _) if tp1.symbol == defn.SingletonClass => false case (_, tp2: TypeRef) if tp2.symbol == defn.SingletonClass => diff --git a/tests/patmat/i18507.scala b/tests/patmat/i18507.scala new file mode 100644 index 000000000000..45a9eaa3572b --- /dev/null +++ b/tests/patmat/i18507.scala @@ -0,0 +1,6 @@ +import scala.quoted.* + +trait DFValOf[T] + +def calcWidth(x: List[Type[?]])(using q: Quotes): Unit = + x.collect { case '[DFValOf[t]] => ???}