diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-12-03 13:14:22 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-01-16 14:41:15 +0100 |
commit | 493197fce6c9c493dfa4dcdd8fd5e29bad82d49b (patch) | |
tree | 2c655aaa246d6cd8759a210f6fca12777f892330 /test/files/neg/t6443c.scala | |
parent | 766bb97114b5932b75340a9169558de61899997e (diff) | |
download | scala-493197fce6c9c493dfa4dcdd8fd5e29bad82d49b.tar.gz scala-493197fce6c9c493dfa4dcdd8fd5e29bad82d49b.tar.bz2 scala-493197fce6c9c493dfa4dcdd8fd5e29bad82d49b.zip |
SI-6443 Widen dependent param types in uncurry
Bridge building operates on unusual method signatures:
after uncurry, so parameter lists are collapsed; but before
erasure, so dependently typed parameters are still around.
Original:
def foo(a: T)(b: a.type, c: a.U): Unit
During computeBridges:
(a: T, b: a.type, c: a.U)Unit
This signature no longer appears to override the corresponding
one in a superclass, because the types of `b` and `c` are dependent
on method parameters.
The root of the problem is uncurry, which leaves the trees in
a poor state. This commit changes uncurry to remedy this.
An example illustrates it best:
// source
def foo(a: A)(b: a.type): b.type = b
// post uncurry before this patch.
// not well typed code!
def foo(a: A, b: a.type): a.type = {
// post uncurry after this patch
def foo(a: A, b: A): A = {
val b$1 = b.asInstanceOf[a.type]
b$1
}
Diffstat (limited to 'test/files/neg/t6443c.scala')
-rw-r--r-- | test/files/neg/t6443c.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/files/neg/t6443c.scala b/test/files/neg/t6443c.scala new file mode 100644 index 0000000000..817224e043 --- /dev/null +++ b/test/files/neg/t6443c.scala @@ -0,0 +1,21 @@ +trait A { + type D >: Null <: C + def foo(d: D)(a: Any, d2: d.type): Unit + trait C { + def bar: Unit = foo(null)(null, null) + } +} +object B extends A { + class D extends C + + def foo(d: D)(a: Any, d2: d.type): Unit = () // Bridge method required here! + + // No bridge method should be added, but we'll be happy enough if + // the "same type after erasure" error kicks in before the duplicated + // bridge causes a problem. + def foo(d: D)(a: Any)(d2: d.type): Unit = () +} + +object Test extends App { + new B.D().bar +} |