diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-05-20 13:59:00 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-05-20 13:59:00 +0200 |
commit | 076b1c4235293d4b306913aee485c49ec4736af9 (patch) | |
tree | 62b0efe65c503da1857d3a185021b00301b8910b /test/files/run/t5125b.scala | |
parent | 1f5584fbe183041d4af269278f0125e2f0b94a44 (diff) | |
download | scala-076b1c4235293d4b306913aee485c49ec4736af9.tar.gz scala-076b1c4235293d4b306913aee485c49ec4736af9.tar.bz2 scala-076b1c4235293d4b306913aee485c49ec4736af9.zip |
Fix @varargs forwarder generation in the presence of nested templates.
Makes `newMembers` a Map[Symbol, Buffer[Tree]] to ensure we add the forwarders to the right template.
Closes SI-5125.
Diffstat (limited to 'test/files/run/t5125b.scala')
-rw-r--r-- | test/files/run/t5125b.scala | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/files/run/t5125b.scala b/test/files/run/t5125b.scala new file mode 100644 index 0000000000..3b3596d8bf --- /dev/null +++ b/test/files/run/t5125b.scala @@ -0,0 +1,37 @@ +class C1 { + @scala.annotation.varargs + def f(values:String*) = println("Calling C1.f(): " + values) +} + +class C2 { + @scala.annotation.varargs + def f(values:String*) = println("Calling C2.f(): " + values) + // def g(): String => Int = s => s.hashCode + + class C3 { + @scala.annotation.varargs + def f(values:String*) = println("Calling C3.f(): " + values) + } +} + +class C4 { + def f(values: String*) = println("Calling C4.f(): " + values) + + locally { + @scala.annotation.varargs + def f(values: String*) = println("Calling C4.<locally>.f(): " + values) + } +} + +object Test extends App { + def check(c: Class[_]) { + val methodName = "f" + val methods = c.getDeclaredMethods.filter(_.getName == methodName) + println(methods.map(_.toString).sorted.mkString("\n")) + } + + check(classOf[C1]) + check(classOf[C2]) + check(classOf[C2#C3]) + check(classOf[C4]) +} |