summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-12-08 18:15:08 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-12-08 20:50:27 +0100
commit818a2e6597f23a82f848cd1f7d3b2e29129390a6 (patch)
treeff9629e82e14dccd410fb8d21e5224b69508a29d /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
parent0acb8a30c379f268e8a3e1340504530493a1a1dc (diff)
downloadscala-818a2e6597f23a82f848cd1f7d3b2e29129390a6.tar.gz
scala-818a2e6597f23a82f848cd1f7d3b2e29129390a6.tar.bz2
scala-818a2e6597f23a82f848cd1f7d3b2e29129390a6.zip
SI-6555 Better parameter name retention
We were losing track of parameter names in two places: 1. Uncurry was using fresh names for the apply method parameters during Function expansion. (The parameter names in the tree were actually correct, they just had synthetic symbols with "x$1" etc.) 2. When adding specialized overrides, the parameter names of the overriden method were used, rather than the parameter names from the overriding method in the class to which we are adding methods. The upshot of this is that when you're stopped in the debugger in the body of, say, `(i: Int) => i * i`, you see `v1` rather than `i`. This commit changes Uncurry and SpecializeTypes to remedy this.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 2f79472cfb..bbab545d9e 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -965,6 +965,11 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
case (NoSymbol, _) => None
case (overridden, env) =>
val om = specializedOverload(clazz, overridden, env)
+ foreachWithIndex(om.paramss) { (params, i) =>
+ foreachWithIndex(params) { (param, j) =>
+ param.name = overriding.paramss(i)(j).name // SI-6555 Retain the parameter names from the subclass.
+ }
+ }
debuglog("specialized overload %s for %s in %s: %s".format(om, overriding.name.decode, pp(env), om.info))
typeEnv(om) = env
addConcreteSpecMethod(overriding)