aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/pos/t6482.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/pos/t6482.scala')
-rw-r--r--tests/untried/pos/t6482.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/untried/pos/t6482.scala b/tests/untried/pos/t6482.scala
new file mode 100644
index 000000000..24ea38e51
--- /dev/null
+++ b/tests/untried/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
+}