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 {
447
447
// - Scala's arrays are invariant (so we don't drop type tests unsoundly)
448
448
if (extractorArgTypeTest) mkDefault
449
449
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)
451
454
// TODO SIP-23: should we test equality for literal types with eq?
452
455
// Conceptually cleaner, as SingleType is tested using eq.
453
456
// 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