diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pos/extmethods.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/pos/extmethods.scala b/tests/pos/extmethods.scala index cac1c4ec1..fe95a1c79 100644 --- a/tests/pos/extmethods.scala +++ b/tests/pos/extmethods.scala @@ -9,3 +9,14 @@ class Foo[+A <: AnyRef](val xs: List[A]) extends AnyVal { def baz[B >: A](x: B): List[B] = ??? } +object CollectionStrawMan { + import collection.mutable.ArrayBuffer + import reflect.ClassTag + + implicit class ArrayOps[A](val xs: Array[A]) extends AnyVal { + + def elemTag: ClassTag[A] = ClassTag(xs.getClass.getComponentType) + + protected[this] def newBuilder = new ArrayBuffer[A].mapResult(_.toArray(elemTag)) + } +} |