summaryrefslogtreecommitdiff
path: root/test/files/run/virtpatmat_typetag.check
diff options
context:
space:
mode:
authorclhodapp <clhodapp1@gmail.com>2014-05-29 21:44:46 -0700
committerclhodapp <clhodapp1@gmail.com>2014-06-10 21:19:33 -0700
commit1a20152e97fe772e299fa3eb2608bedcea95cb82 (patch)
treee656a2998b292b9189f8a6e6072beaf63e24fed1 /test/files/run/virtpatmat_typetag.check
parentda2896c4e5a1e037bc3a473bc9d1689378816a32 (diff)
downloadscala-1a20152e97fe772e299fa3eb2608bedcea95cb82.tar.gz
scala-1a20152e97fe772e299fa3eb2608bedcea95cb82.tar.bz2
scala-1a20152e97fe772e299fa3eb2608bedcea95cb82.zip
SI-6967 Fix ClassTag unapply for primitives
This commit fixes the behavior of ClassTag's Any-accepting unapply overload. Previously, ClassTag had overloads of unapply that accepted all of the Java primitive aliases (language-supported magic classes extending AnyVal), as well as an implementation that accepted an Any. All of the AnyVal-accepting (more specific) versions of the methods worked correctly. However, the Any-accepting version incorrectly handled these types. For example, ClassTag.Int.unapply(3) would return Some(3) (through the Int-accepting overload), while ClassTag.Int.unapply(3: Any) would return None (through the Any-accepting overload). This commit unifies these behaviors, making ClassTag.Int.unapply(3: Any) return Some(3). It accomplishes this by adding a pattern match on the type of that method's argument, which will delegate to one of the more-specifically-typed overloads if possible. It also improves the formatting of the code a bit. One thing to note (though I doubt anyone will ever do this based on this message) is that the AnyVal-subtype-accepting overloads should be removed in Scala 2.12, as they are unneeded. I placed a note to this effect into the code.
Diffstat (limited to 'test/files/run/virtpatmat_typetag.check')
-rw-r--r--test/files/run/virtpatmat_typetag.check4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/files/run/virtpatmat_typetag.check b/test/files/run/virtpatmat_typetag.check
index cac9d9a4d6..00df8b5e81 100644
--- a/test/files/run/virtpatmat_typetag.check
+++ b/test/files/run/virtpatmat_typetag.check
@@ -1,9 +1,9 @@
-1 is not a Int; it's a class java.lang.Integer
+1 is a Int
1 is a java.lang.Integer
1 is not a java.lang.String; it's a class java.lang.Integer
true is a Any
woele is a java.lang.String
-1 is not a Int; it's a class java.lang.Integer
+1 is a Int
1 is a java.lang.Integer
1 is not a java.lang.String; it's a class java.lang.Integer
true is a Any