summaryrefslogtreecommitdiff
path: root/project
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 /project
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 'project')
-rw-r--r--project/GenerateAnyVals.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/project/GenerateAnyVals.scala b/project/GenerateAnyVals.scala
index 921982aeec..84454cb0ed 100644
--- a/project/GenerateAnyVals.scala
+++ b/project/GenerateAnyVals.scala
@@ -225,7 +225,9 @@ import scala.language.implicitConversions"""
"@unboxRunTimeDoc@" -> """
* Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxTo%s`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]].
*""".format(name),
- "@unboxDoc@" -> "the %s resulting from calling %sValue() on `x`".format(name, lcname)
+ "@unboxDoc@" -> "the %s resulting from calling %sValue() on `x`".format(name, lcname),
+ "@boxImpl@" -> "???",
+ "@unboxImpl@" -> "???"
)
def interpolations = Map(
"@name@" -> name,
@@ -296,7 +298,7 @@ package scala
* @param x the @name@ to be boxed
* @return a @boxed@ offering `x` as its underlying value.
*/
-def box(x: @name@): @boxed@ = ???
+def box(x: @name@): @boxed@ = @boxImpl@
/** Transform a boxed type into a value type. Note that this
* method is not typesafe: it accepts any Object, but will throw
@@ -306,7 +308,7 @@ def box(x: @name@): @boxed@ = ???
* @throws ClassCastException if the argument is not a @boxed@
* @return @unboxDoc@
*/
-def unbox(x: java.lang.Object): @name@ = ???
+def unbox(x: java.lang.Object): @name@ = @unboxImpl@
/** The String representation of the scala.@name@ companion object. */
override def toString = "object scala.@name@"
@@ -458,7 +460,9 @@ override def getClass(): Class[Boolean] = ???
override def boxUnboxInterpolations = Map(
"@boxRunTimeDoc@" -> "",
"@unboxRunTimeDoc@" -> "",
- "@unboxDoc@" -> "the Unit value ()"
+ "@unboxDoc@" -> "the Unit value ()",
+ "@boxImpl@" -> "scala.runtime.BoxedUnit.UNIT",
+ "@unboxImpl@" -> "x.asInstanceOf[scala.runtime.BoxedUnit]"
)
}