Skip to content

Commit 54b95a4

Browse files
authored
Teach provablyDisjoint about AnyKind (#18510)
2 parents fef4245 + 4f29008 commit 54b95a4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2828,6 +2828,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
28282828
provablyDisjoint(tp1, defn.AnyType)
28292829
case _ if !ctx.erasedTypes && tp1.isFromJavaObject =>
28302830
provablyDisjoint(defn.AnyType, tp2)
2831+
case (tp1: TypeRef, _) if tp1.symbol == defn.AnyKindClass =>
2832+
false
2833+
case (_, tp2: TypeRef) if tp2.symbol == defn.AnyKindClass =>
2834+
false
28312835
case (tp1: TypeRef, _) if tp1.symbol == defn.SingletonClass =>
28322836
false
28332837
case (_, tp2: TypeRef) if tp2.symbol == defn.SingletonClass =>

tests/patmat/i18507.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import scala.quoted.*
2+
3+
trait DFValOf[T]
4+
5+
def calcWidth(x: List[Type[?]])(using q: Quotes): Unit =
6+
x.collect { case '[DFValOf[t]] => ???}

0 commit comments

Comments
 (0)