diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-04 11:32:36 +0200 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-04 11:32:36 +0200 |
commit | 7b2c3cb8bb0f5f96f3182f551eb82cb1c59d460c (patch) | |
tree | 19e6dd4ae9aa6e328bfb8b6daed4564365160b49 /test/files/pos | |
parent | c1492ac08e69e64e258ee9c5a0e5173165f4cba1 (diff) | |
parent | ee2b7d615be8e7d893b78d770cf68a95c8fa0621 (diff) | |
download | scala-7b2c3cb8bb0f5f96f3182f551eb82cb1c59d460c.tar.gz scala-7b2c3cb8bb0f5f96f3182f551eb82cb1c59d460c.tar.bz2 scala-7b2c3cb8bb0f5f96f3182f551eb82cb1c59d460c.zip |
Merge pull request #3995 from retronym/ticket/8267
SI-8267 Avoid existentials after polymorphic overload resolution
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t8267.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/files/pos/t8267.scala b/test/files/pos/t8267.scala new file mode 100644 index 0000000000..37b498fe3e --- /dev/null +++ b/test/files/pos/t8267.scala @@ -0,0 +1,33 @@ +class Bippy { trait Foo[A] } + +final class RichBippy[C <: Bippy with Singleton](val c1: C) { + def f: Int = 1 + def f[A](x: A)(ev: c1.Foo[A]): Int = 2 + + def g[A <: Nothing](x: A): Int = 1 + def g[A](x: A)(ev: c1.Foo[A]): Int = 2 + + def h[A](x: A)(ev: c1.Foo[A]): Int = 1 + + def i(x: Nothing): Int = 1 + def i(x: AnyRef)(ev: c1.Foo[x.type]): Int = 2 +} + +object p { + + val c = new Bippy + val d0 = new RichBippy[c.type](c) + def d1 = new RichBippy[c.type](c) + + d0.f[Int](5)(null: c.Foo[Int]) // ok + d1.f[Int](5)(null: c.Foo[Int]) // fails + + d0.g[Int](5)(null: c.Foo[Int]) // ok + d1.g[Int](5)(null: c.Foo[Int]) // fails + + d0.h[Int](5)(null: c.Foo[Int]) // ok + d1.h[Int](5)(null: c.Foo[Int]) // ok + + d0.i("")(null) // ok + d1.i("")(null) // ok +} |