Skip to content

Commit a45a2b3

Browse files
committed
use isPatternTypeSymbol to avoid duplicate
1 parent 2d5f2d4 commit a45a2b3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ object Checkable {
8080
def replaceX(implicit ctx: Context) = new TypeMap {
8181
def apply(tp: Type) = tp match {
8282
case tref: TypeRef
83-
if !tref.typeSymbol.isClass && tref.symbol.is(Case) =>
83+
if isPatternTypeSymbol(tref.typeSymbol) =>
8484
if (variance == 1) tref.info.hiBound
8585
else if (variance == -1) tref.info.loBound
8686
else OrType(defn.AnyType, defn.NothingType)

tests/neg-custom-args/isInstanceOf/3324h.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ object Test {
22
trait Marker
33
def foo[T](x: T) = x match {
44
case _: (T & Marker) => // no warning
5-
// case _: T with Marker => // scalac emits a warning
5+
case _: T with Marker => // scalac emits a warning
66
case _ =>
77
}
88

0 commit comments

Comments
 (0)