diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Duplicators.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala index 29831c8469..eb0d489901 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala @@ -256,8 +256,16 @@ abstract class Duplicators extends Analyzer { case ldef @ LabelDef(name, params, rhs) => // log("label def: " + ldef) ldef.tpe = null - val params1 = params map (p => Ident(updateSym(p.symbol))) - super.typed(treeCopy.LabelDef(tree, name, params1, rhs), mode, pt) + // since typer does not create the symbols for a LabelDef's params, + // we do that manually here -- we should really refactor LabelDef to be a subclass of DefDef + def newParam(p: Tree): Ident = { + val newsym = p.symbol.cloneSymbol //(context.owner) // TODO owner? + Ident(newsym.setInfo(fixType(p.symbol.info))) + } + val params1 = params map newParam + val rhs1 = (new TreeSubstituter(params map (_.symbol), params1) transform rhs) // TODO: duplicate? + rhs1.tpe = null + super.typed(treeCopy.LabelDef(tree, name, params1, rhs1), mode, pt) case Bind(name, _) => // log("bind: " + tree) |