summaryrefslogtreecommitdiff
path: root/test/files/run/MeterCaseClass.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-09-19 16:19:56 +0200
committerPaul Phillips <paulp@improving.org>2012-09-20 09:41:34 -0700
commite171d6d969fe7ce0dd2fd7a7679d6edb08c7579c (patch)
treef54e7991ce2dcc601f65ed0191b4260d7e6b21ee /test/files/run/MeterCaseClass.scala
parentb94ae90110412e8af1e65230053c0e8aa26cd2d7 (diff)
downloadscala-e171d6d969fe7ce0dd2fd7a7679d6edb08c7579c.tar.gz
scala-e171d6d969fe7ce0dd2fd7a7679d6edb08c7579c.tar.bz2
scala-e171d6d969fe7ce0dd2fd7a7679d6edb08c7579c.zip
Value classes: eliminated half-boxing
We now apply erasure of value classes everywhere. previously, erasure was disabled in the value class itself. This led to irregegularities and bugs. See test run/valueclasses-pavlov.scala for something that led to a ClassCastException before.
Diffstat (limited to 'test/files/run/MeterCaseClass.scala')
-rw-r--r--test/files/run/MeterCaseClass.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/files/run/MeterCaseClass.scala b/test/files/run/MeterCaseClass.scala
index e5979cf761..18f8e23f89 100644
--- a/test/files/run/MeterCaseClass.scala
+++ b/test/files/run/MeterCaseClass.scala
@@ -2,7 +2,7 @@ package a {
case class Meter(underlying: Double) extends AnyVal with _root_.b.Printable {
def + (other: Meter): Meter =
new Meter(this.underlying + other.underlying)
- def / (other: Meter): Double = this.underlying / other.underlying
+ def / (other: Meter)(implicit dummy: Meter.MeterArg = null): Double = this.underlying / other.underlying
def / (factor: Double): Meter = new Meter(this.underlying / factor)
def < (other: Meter): Boolean = this.underlying < other.underlying
def toFoot: Foot = new Foot(this.underlying * 0.3048)
@@ -11,6 +11,8 @@ package a {
object Meter extends (Double => Meter) {
+ private[a] trait MeterArg
+
implicit val boxings = new BoxingConversions[Meter, Double] {
def box(x: Double) = new Meter(x)
def unbox(m: Meter) = m.underlying
@@ -77,7 +79,7 @@ object Test extends App {
println(m)
foo(arr)
}
- //
+ //
// { println("testing wrapped arrays")
// import collection.mutable.FlatArray
// val arr = FlatArray(x, y + x)