summaryrefslogtreecommitdiff
path: root/test/files/pos/t6482.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-06 10:20:45 -0700
committerPaul Phillips <paulp@improving.org>2012-10-06 11:48:15 -0700
commitff9f60f420c090b6716c927ab0359b082f2299de (patch)
tree6d26e3d9f05931ad271a37c6459da5b84d856595 /test/files/pos/t6482.scala
parent883f1ac88dd7cec5882d42d6b48d7f267d1f6e00 (diff)
downloadscala-ff9f60f420c090b6716c927ab0359b082f2299de.tar.gz
scala-ff9f60f420c090b6716c927ab0359b082f2299de.tar.bz2
scala-ff9f60f420c090b6716c927ab0359b082f2299de.zip
Fix for SI-6482, lost bounds in extension methods.
That was a good one. How to create a new method with type parameters from multiple sources, herein.
Diffstat (limited to 'test/files/pos/t6482.scala')
-rw-r--r--test/files/pos/t6482.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t6482.scala b/test/files/pos/t6482.scala
new file mode 100644
index 0000000000..24ea38e519
--- /dev/null
+++ b/test/files/pos/t6482.scala
@@ -0,0 +1,11 @@
+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))
+}
+// error: type arguments [B] do not conform to method reduceLeft's type parameter bounds [B >: A]
+// 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] = x :: xs
+}