aboutsummaryrefslogtreecommitdiff
path: root/tests/run
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-11-17 23:41:02 +0100
committerGuillaume Martres <smarter@ubuntu.com>2015-11-18 03:32:01 +0100
commit7d76151109db168d025dfc0f6501fa7694e17053 (patch)
tree2cc70c0eadab25304c03aa2d494097e60bac077a /tests/run
parent945334c8affd0dc5067316447e8384f1ea7025ad (diff)
downloaddotty-7d76151109db168d025dfc0f6501fa7694e17053.tar.gz
dotty-7d76151109db168d025dfc0f6501fa7694e17053.tar.bz2
dotty-7d76151109db168d025dfc0f6501fa7694e17053.zip
Fix ambiguity errors with polymorphic implicits
Previously, `isAsSpecific(alt1, tp1, alt2, tp2)` did not handle having `tp2` be a polymorphic non-method type like `[A]Foo[A]`. Also update the documentation of `isAsSpecific` to account for this change, the new documentation is based on SLS ยง 6.26.3 but adapted to reflect the code.
Diffstat (limited to 'tests/run')
-rw-r--r--tests/run/implicits_poly.check1
-rw-r--r--tests/run/implicits_poly.scala14
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/run/implicits_poly.check b/tests/run/implicits_poly.check
new file mode 100644
index 000000000..0b148ee47
--- /dev/null
+++ b/tests/run/implicits_poly.check
@@ -0,0 +1 @@
+barFoo
diff --git a/tests/run/implicits_poly.scala b/tests/run/implicits_poly.scala
new file mode 100644
index 000000000..2a5d68f73
--- /dev/null
+++ b/tests/run/implicits_poly.scala
@@ -0,0 +1,14 @@
+class Foo[A](val x: String)
+class Bar[A](x: String) extends Foo[A](x)
+
+object Test {
+ implicit def anyRefFoo[A <: AnyRef]: Foo[A] = new Foo("anyRefFoo")
+ implicit def fooFoo[A]: Foo[Foo[A]] = new Foo("fooFoo")
+ implicit def barFoo[A]: Bar[Foo[A]] = new Bar("barFoo")
+
+ def getFooFoo(implicit ev: Foo[Foo[Int]]) = ev
+
+ def main(args: Array[String]): Unit = {
+ println(getFooFoo.x)
+ }
+}