diff options
author | Paul Phillips <paulp@improving.org> | 2012-07-24 16:54:07 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-07-24 20:45:01 -0700 |
commit | 6eb55d4b7ab804ba581157ed39df42ded885a12e (patch) | |
tree | 73e2c32c11695ea5e222a8f378261f1cdcd0e617 /test/files | |
parent | 392438b77ea4961c919e3115055336ce6fca85af (diff) | |
download | scala-6eb55d4b7ab804ba581157ed39df42ded885a12e.tar.gz scala-6eb55d4b7ab804ba581157ed39df42ded885a12e.tar.bz2 scala-6eb55d4b7ab804ba581157ed39df42ded885a12e.zip |
Fix SI-4560, NoSuchMethodErrors involving self types.
Following this commit are reversions of three prior commits which
introduced difficulties of their own, plus extra tests for this
issue and SI-4601, all of which I pinched from jrudolph.
Maybe there was a good reason for some of the complicated code
related to this ticket. I took the naive position that if we avoided
generating a method call to a particular receiver if the receiver
has no such method, we would encounter fewer NoSuchMethodErrors.
I would believe one can construct a scenario which this doesn't
handle correctly, but it's hard to believe this isn't a big
improvement. Review by @jrudolph, @odersky.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t4560b.check | 2 | ||||
-rw-r--r-- | test/files/run/t4560b.scala | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/test/files/run/t4560b.check b/test/files/run/t4560b.check new file mode 100644 index 0000000000..7ee6e19b28 --- /dev/null +++ b/test/files/run/t4560b.check @@ -0,0 +1,2 @@ +23 +SUCCESS diff --git a/test/files/run/t4560b.scala b/test/files/run/t4560b.scala new file mode 100644 index 0000000000..97fe00ce37 --- /dev/null +++ b/test/files/run/t4560b.scala @@ -0,0 +1,28 @@ +object Outer { + class Tester + private[Outer] trait B4 { _: Tester => + protected val FREQ = 23 + def fail() = { + println(FREQ) + } + } + object C4 extends Tester with B4 +} + +object Outer2 { + abstract class A5 + private[Outer2] trait C5 { + def impl() { println("SUCCESS") } + } + trait B5 extends C5 { self: A5 => + def fail() { impl() } + } + object Test5 extends A5 with B5 with C5 +} + +object Test { + def main(args: Array[String]): Unit = { + Outer.C4.fail() + Outer2.Test5.fail() + } +} |