File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/compiler/scala/tools/nsc/transform/patmat Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -447,7 +447,10 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
447447 // - Scala's arrays are invariant (so we don't drop type tests unsoundly)
448448 if (extractorArgTypeTest) mkDefault
449449 else expectedTp match {
450- case SingleType (_, sym) => mkEqTest(gen.mkAttributedQualifier(expectedTp)) // SI-4577, SI-4897
450+ case SingleType (_, sym) =>
451+ val expected = gen.mkAttributedQualifier(expectedTp)
452+ if (expectedTp <:< AnyRefTpe ) mkEqTest(expected) // SI-4577, SI-4897
453+ else mkEqualsTest(expected)
451454 // TODO SIP-23: should we test equality for literal types with eq?
452455 // Conceptually cleaner, as SingleType is tested using eq.
453456 // In practice it doesn't really matter, since `equals` does the same thing as `eq` in the `AnyVal` subclasses of `Any`.
You can’t perform that action at this time.
0 commit comments