aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/extmethods.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-05-03 16:41:29 +0200
committerMartin Odersky <odersky@gmail.com>2015-05-03 16:41:29 +0200
commit220fe53ad0638c33572a9e11db0b6dc3aabd6c27 (patch)
tree30fc8bfeb1ad330f1c5bab78fb227a32dfa76e14 /tests/pos/extmethods.scala
parentbb6582bd265d22186570bef81d2a2f9ab3e23f9d (diff)
downloaddotty-220fe53ad0638c33572a9e11db0b6dc3aabd6c27.tar.gz
dotty-220fe53ad0638c33572a9e11db0b6dc3aabd6c27.tar.bz2
dotty-220fe53ad0638c33572a9e11db0b6dc3aabd6c27.zip
Fix #522.
We were missing a substitution in full parameterization. Embarraingly, this made even the example in the doc comment of `fullyParameterizedDef` fail.
Diffstat (limited to 'tests/pos/extmethods.scala')
-rw-r--r--tests/pos/extmethods.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/pos/extmethods.scala b/tests/pos/extmethods.scala
index 2d418cadc..eeab3c24f 100644
--- a/tests/pos/extmethods.scala
+++ b/tests/pos/extmethods.scala
@@ -5,3 +5,13 @@ class T[A, This <: That1[A]](val x: Int) extends AnyVal {
final def loop(x: This, cnt: Int): Int = loop(x, cnt + 1)
def const[B](): Boolean = return true
}
+
+final class TraversableOnceOps[+A](val collection: TraversableOnce[A]) extends AnyVal {
+ def reduceLeftOption[B >: A](op: (B, A) => B): Option[B] =
+ if (collection.isEmpty) None else Some(collection.reduceLeft[B](op))
+}
+
+class Foo[+A <: AnyRef](val xs: List[A]) extends AnyVal {
+ def baz[B >: A](x: B): List[B] = ???
+}
+