summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-03-16 11:55:44 +0100
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-03-20 19:53:57 +0100
commit2d3b309a36757545901b99da1b77698749fcc0c5 (patch)
treefddd7d0393d5151f2191a323eac2e59b7271a517
parentcd3d342032613e52e5917f3900f2461536a54e26 (diff)
downloadscala-2d3b309a36757545901b99da1b77698749fcc0c5.tar.gz
scala-2d3b309a36757545901b99da1b77698749fcc0c5.tar.bz2
scala-2d3b309a36757545901b99da1b77698749fcc0c5.zip
specialize symbols for labeldef params
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Duplicators.scala12
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)