diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-27 12:40:29 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-27 12:40:38 +0200 |
commit | 0d44e9ea121fc664a97791b6ad29631cd3aba8f6 (patch) | |
tree | e8ee267d2a19809a53bf321746c7472bda7a1e2a /tests | |
parent | 568e48961e423a1dd1425c2c65bc129edba3f700 (diff) | |
download | dotty-0d44e9ea121fc664a97791b6ad29631cd3aba8f6.tar.gz dotty-0d44e9ea121fc664a97791b6ad29631cd3aba8f6.tar.bz2 dotty-0d44e9ea121fc664a97791b6ad29631cd3aba8f6.zip |
Fix substDealias
substDealias did not follow aliases when the prefix of a typeref changed
under substitution. This was exhibited by a bug in extensionMethods which was
first discovered in CollectionStrawMan6 and was minimized in extmethods.
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)) + } +} |