summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-04-15 16:41:03 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-04-20 10:13:02 +0200
commitc600c15488b97e7b1f72e6b7811f53f03a493c1c (patch)
tree7bdba1077d32d370b166beca1de1c427d8821aff /src/library
parentd6f66ec0f38e42c19f79cbe9d32d29c65dee1e05 (diff)
downloadscala-c600c15488b97e7b1f72e6b7811f53f03a493c1c.tar.gz
scala-c600c15488b97e7b1f72e6b7811f53f03a493c1c.tar.bz2
scala-c600c15488b97e7b1f72e6b7811f53f03a493c1c.zip
SI-6710 / PR 5072 follow-up: fix Unit.box / Unit.unbox
The backend replaces .box / .unbox methods by corresponding invocations to BoxesRunTime, but not for Unit. This commit restores the body of `Unit.box` and `Unit.unbox`.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/Unit.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/Unit.scala b/src/library/scala/Unit.scala
index 397d7b823b..eb6d1d0ddf 100644
--- a/src/library/scala/Unit.scala
+++ b/src/library/scala/Unit.scala
@@ -30,7 +30,7 @@ object Unit extends AnyValCompanion {
* @param x the Unit to be boxed
* @return a scala.runtime.BoxedUnit offering `x` as its underlying value.
*/
- def box(x: Unit): scala.runtime.BoxedUnit = ???
+ def box(x: Unit): scala.runtime.BoxedUnit = scala.runtime.BoxedUnit.UNIT
/** Transform a boxed type into a value type. Note that this
* method is not typesafe: it accepts any Object, but will throw
@@ -40,7 +40,7 @@ object Unit extends AnyValCompanion {
* @throws ClassCastException if the argument is not a scala.runtime.BoxedUnit
* @return the Unit value ()
*/
- def unbox(x: java.lang.Object): Unit = ???
+ def unbox(x: java.lang.Object): Unit = x.asInstanceOf[scala.runtime.BoxedUnit]
/** The String representation of the scala.Unit companion object. */
override def toString = "object scala.Unit"