Skip to content

Commit

Permalink
Teach provablyDisjoint about AnyKind (#18510)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrd authored Sep 4, 2023
2 parents fef4245 + 4f29008 commit 54b95a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
6 changes: 6 additions & 0 deletions tests/patmat/i18507.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import scala.quoted.*

trait DFValOf[T]

def calcWidth(x: List[Type[?]])(using q: Quotes): Unit =
x.collect { case '[DFValOf[t]] => ???}

0 comments on commit 54b95a4

Please sign in to comment.