summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStefan Zeiger <szeiger@novocode.com>2017-02-16 22:09:05 +0100
committerStefan Zeiger <szeiger@novocode.com>2017-02-21 11:27:10 +0100
commit1d22ee4ba3032941cdc45677a7ce6082fd317580 (patch)
treec0ed0518aad37025aeca56391f244a6d81e886be /test
parentc8b80053bd41b5a6cf4c03b2a709099ae1b668d7 (diff)
downloadscala-1d22ee4ba3032941cdc45677a7ce6082fd317580.tar.gz
scala-1d22ee4ba3032941cdc45677a7ce6082fd317580.tar.bz2
scala-1d22ee4ba3032941cdc45677a7ce6082fd317580.zip
SI-10194: Fix abstract type resolution for overloaded HOFs
Types in the applicable overload alternatives need to be seen from the respective owners of the individual alternative, not from the target’s owner (which can be a subtype of the types that define the methods).
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/overloaded_ho_fun.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/pos/overloaded_ho_fun.scala b/test/files/pos/overloaded_ho_fun.scala
index 2699ad35f8..17176715f0 100644
--- a/test/files/pos/overloaded_ho_fun.scala
+++ b/test/files/pos/overloaded_ho_fun.scala
@@ -49,3 +49,18 @@ object sorting {
// def andThen[C](g: Bijection[B, C]): Bijection[A, C] = ???
// def compose[T](g: Bijection[T, A]) = g andThen this
// }
+
+object SI10194 {
+ trait X[A] {
+ def map[B](f: A => B): Unit
+ }
+
+ trait Y[A] extends X[A] {
+ def map[B](f: A => B)(implicit ordering: Ordering[B]): Unit
+ }
+
+ trait Z[A] extends Y[A]
+
+ (null: Y[Int]).map(x => x.toString) // compiled
+ (null: Z[Int]).map(x => x.toString) // didn't compile
+}