summaryrefslogtreecommitdiff
path: root/test/files/jvm/t8786/A_1.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-07-05 14:22:00 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-08-11 11:36:51 +0200
commit0d2760dce189cdcb363e54868381175af4b2646f (patch)
treedc4aa2565c62189f25d9d89e07262f16718e9c7f /test/files/jvm/t8786/A_1.scala
parent6612ba010b0e70c53550d1e47141c8dc89a55f23 (diff)
downloadscala-0d2760dce189cdcb363e54868381175af4b2646f.tar.gz
scala-0d2760dce189cdcb363e54868381175af4b2646f.tar.bz2
scala-0d2760dce189cdcb363e54868381175af4b2646f.zip
SI-8786 fix generic signature for @varargs forwarder methods
When generating a varargs forwarder for def foo[T](a: T*) the parameter type of the forwarder needs to be Array[Object]. If we gnerate Array[T] in UnCurry, that would be erased to plain Object, and the method would not be a valid varargs. Unfortunately, setting the parameter type to Array[Object] lead to an invalid generic signature - the generic signature should reflect the real signature. This change adds an attachment to the parameter symbol in the varargs forwarder method and special-cases signature generation. Also cleanes up the code to produce the varargs forwarder. For example, type parameter and parameter symbols in the forwarder's method type were not clones, but the same symbols from the original method were re-used.
Diffstat (limited to 'test/files/jvm/t8786/A_1.scala')
-rw-r--r--test/files/jvm/t8786/A_1.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/files/jvm/t8786/A_1.scala b/test/files/jvm/t8786/A_1.scala
new file mode 100644
index 0000000000..13c0ad191d
--- /dev/null
+++ b/test/files/jvm/t8786/A_1.scala
@@ -0,0 +1,3 @@
+class A {
+ @annotation.varargs def foo[T](a: Int, b: T*): T = b.head
+}