summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-09-13 17:51:38 +0000
committerPaul Phillips <paulp@improving.org>2010-09-13 17:51:38 +0000
commit561a8077e67c92c7dd01cf2aa438a48c120398a4 (patch)
treee1e6568a7f6d06a76de45153796ebe628c0be9a4 /src
parentcfb6168dc5eef906b2552c7b40765db1d6720652 (diff)
downloadscala-561a8077e67c92c7dd01cf2aa438a48c120398a4.tar.gz
scala-561a8077e67c92c7dd01cf2aa438a48c120398a4.tar.bz2
scala-561a8077e67c92c7dd01cf2aa438a48c120398a4.zip
Interpreted absence of any objections in mailin...
Interpreted absence of any objections in mailing list thread http://www.scala-lang.org/node/7398 as implicit encouragement to proceed. Adds complementary implicits to Predef such that the eight primitive types are both boxed and unboxed as the occasion demands. Review by odersky.
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/Predef.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 1e926ea07a..3c44a1f992 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -261,7 +261,7 @@ object Predef extends LowPriorityImplicits {
implicit def float2double(x: Float): Double = x.toDouble
- // "Autoboxing" --------------------------------------------------------------
+ // "Autoboxing" and "Autounboxing" ---------------------------------------------------
implicit def byte2Byte(x: Byte) = java.lang.Byte.valueOf(x)
implicit def short2Short(x: Short) = java.lang.Short.valueOf(x)
@@ -272,6 +272,15 @@ object Predef extends LowPriorityImplicits {
implicit def double2Double(x: Double) = java.lang.Double.valueOf(x)
implicit def boolean2Boolean(x: Boolean) = java.lang.Boolean.valueOf(x)
+ implicit def Byte2byte(x: java.lang.Byte): Byte = x.byteValue
+ implicit def Short2short(x: java.lang.Short): Short = x.shortValue
+ implicit def Character2char(x: java.lang.Character): Char = x.charValue
+ implicit def Integer2int(x: java.lang.Integer): Int = x.intValue
+ implicit def Long2long(x: java.lang.Long): Long = x.longValue
+ implicit def Float2float(x: java.lang.Float): Float = x.floatValue
+ implicit def Double2double(x: java.lang.Double): Double = x.doubleValue
+ implicit def Boolean2boolean(x: java.lang.Boolean): Boolean = x.booleanValue
+
// Strings and CharSequences --------------------------------------------------------------
implicit def any2stringadd(x: Any) = new runtime.StringAdd(x)