summaryrefslogtreecommitdiff
path: root/test/files/run/t6318_primitives.check
Commit message (Collapse)AuthorAgeFilesLines
* SI-6967 Fix ClassTag unapply for primitivesclhodapp2014-06-101-18/+36
| | | | | | | | | | | | | | | | | | | | | | 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.
* Normalized line endings.Paul Phillips2012-09-201-36/+36
| | | | | | This brings all the files into line with the .gitattributes settings, which should henceforth be automatically maintained by git.
* SI-6318 fixes ClassTag.unapply for primitivesEugene Burmako2012-09-061-0/+36
ClassTag.unapply now has overloads for primitive value classes so that it can preserve boxiness when performing subtyping tests. First I wanted to annotate ClassTag.unapply with a ClassTag itself, i.e. to transform its signature from "def unapply(x: Any): Option[T]" to "def unapply[U: ClassTag](x: U): Option[T]". But then virtpatmat_typetag.scala exhibited a nasty problem. When pattern matching with this unapply, patmat first infers U as something and then tries to pattern match against this inferred type. And if U gets inferred as an abstract type itself, bad things happen: warning: The outer reference in this type test cannot be checked at run time. That's why I decided to drop the ClassTag idea and go with 9 extra overloads. Not very beautiful, but definitely robust.