aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/t6482.scala
blob: 24ea38e519a44d084e5b89d0044e8d87bf43a1f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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
}