diff options
Diffstat (limited to 'test/files/run/Meter.scala')
-rw-r--r-- | test/files/run/Meter.scala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/files/run/Meter.scala b/test/files/run/Meter.scala index d94f338ca9..a10ad31b4a 100644 --- a/test/files/run/Meter.scala +++ b/test/files/run/Meter.scala @@ -1,8 +1,13 @@ package a { + abstract class BoxingConversions[Boxed, Unboxed] { + def box(x: Unboxed): Boxed + def unbox(x: Boxed): Unboxed + } + class Meter(val 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) @@ -12,6 +17,8 @@ package a { object Meter extends (Double => Meter) { + private[a] trait MeterArg + def apply(x: Double): Meter = new Meter(x) implicit val boxings = new BoxingConversions[Meter, Double] { @@ -80,7 +87,7 @@ object Test extends App { println(m) foo(arr) } - // + // // { println("testing wrapped arrays") // import collection.mutable.FlatArray // val arr = FlatArray(x, y + x) |