diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2015-11-17 23:41:02 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-11-18 03:32:01 +0100 |
commit | 7d76151109db168d025dfc0f6501fa7694e17053 (patch) | |
tree | 2cc70c0eadab25304c03aa2d494097e60bac077a /tests | |
parent | 945334c8affd0dc5067316447e8384f1ea7025ad (diff) | |
download | dotty-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')
-rw-r--r-- | tests/run/implicits_poly.check | 1 | ||||
-rw-r--r-- | tests/run/implicits_poly.scala | 14 |
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) + } +} |