Skip to content

Commit 555bce3

Browse files
committed
Fix #5494: Spurious unchecked warning when type testing an alias
1 parent 1b00033 commit 555bce3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ object TypeTestsCasts {
117117
res
118118
}
119119

120-
def recur(X: Type, P: Type): Boolean = (X <:< P) || (P match {
120+
def recur(X: Type, P: Type): Boolean = (X <:< P) || (P.dealias match {
121121
case _: SingletonType => true
122122
case _: TypeProxy
123123
if isAbstract(P) => false
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class A
2+
class B
3+
4+
type AorB = A | B
5+
6+
def foo(any: Any) = any match {
7+
case aorb: AorB =>
8+
case _ =>
9+
}
10+

0 commit comments

Comments
 (0)