diff options
author | odersky <odersky@gmail.com> | 2015-05-03 19:15:39 +0200 |
---|---|---|
committer | odersky <odersky@gmail.com> | 2015-05-03 19:15:39 +0200 |
commit | 2a85b43b6d6264bf2b2cf0a2f09a050be973b347 (patch) | |
tree | 29142707eaa82b6dc9809773deaebd61bf218efe /tests/pos | |
parent | 8718d46194df369014d975e83a45215a5dfd88c9 (diff) | |
parent | 090a6a606f22ceb0b2800556f5d5de825a3941b8 (diff) | |
download | dotty-2a85b43b6d6264bf2b2cf0a2f09a050be973b347.tar.gz dotty-2a85b43b6d6264bf2b2cf0a2f09a050be973b347.tar.bz2 dotty-2a85b43b6d6264bf2b2cf0a2f09a050be973b347.zip |
Merge pull request #526 from dotty-staging/fix/#522
Fix #522.
Diffstat (limited to 'tests/pos')
-rw-r--r-- | tests/pos/extmethods.scala | 5 | ||||
-rw-r--r-- | tests/pos/t6482.scala | 11 | ||||
-rw-r--r-- | tests/pos/t7022.scala | 9 |
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/pos/extmethods.scala b/tests/pos/extmethods.scala index 2d418cadc..3edfa2d75 100644 --- a/tests/pos/extmethods.scala +++ b/tests/pos/extmethods.scala @@ -5,3 +5,8 @@ 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 } + +class Foo[+A <: AnyRef](val xs: List[A]) extends AnyVal { + def baz[B >: A](x: B): List[B] = ??? +} + diff --git a/tests/pos/t6482.scala b/tests/pos/t6482.scala new file mode 100644 index 000000000..24ea38e51 --- /dev/null +++ b/tests/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 +} diff --git a/tests/pos/t7022.scala b/tests/pos/t7022.scala new file mode 100644 index 000000000..c86602664 --- /dev/null +++ b/tests/pos/t7022.scala @@ -0,0 +1,9 @@ +class Catch[+T] { + def either[U >: T](body: => U): Either[Throwable, U] = ??? +} + +object Test { + implicit class RichCatch[T](val c: Catch[T]) extends AnyVal { + def validation[U >: T](u: => U): Either[Throwable, U] = c.either(u) + } +} |