diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-15 12:02:26 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-15 12:02:26 -0700 |
commit | 32d470d61195cbf092614711b27db396d0d54a40 (patch) | |
tree | 85cba7c75066e0be26612fd84ded39491560a0d5 /src | |
parent | cfecf4b7392d8a8a886d4b336ea9d696642012cc (diff) | |
parent | 267650cf9c3b07e360a59f3c5b70b37fea9de453 (diff) | |
download | scala-32d470d61195cbf092614711b27db396d0d54a40.tar.gz scala-32d470d61195cbf092614711b27db396d0d54a40.tar.bz2 scala-32d470d61195cbf092614711b27db396d0d54a40.zip |
Merge pull request #1499 from paulp/issue/6206
Fix for SI-6206, inconsistency with apply.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 546baba996..a83787a43c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1044,15 +1044,21 @@ trait Typers extends Modes with Adaptations with Tags { def insertApply(): Tree = { assert(!inHKMode(mode), modeString(mode)) //@M - val qual = adaptToName(tree, nme.apply) match { - case id @ Ident(_) => - val pre = if (id.symbol.owner.isPackageClass) id.symbol.owner.thisType - else if (id.symbol.owner.isClass) - context.enclosingSubClassContext(id.symbol.owner).prefix - else NoPrefix - stabilize(id, pre, EXPRmode | QUALmode, WildcardType) - case sel @ Select(qualqual, _) => - stabilize(sel, qualqual.tpe, EXPRmode | QUALmode, WildcardType) + val adapted = adaptToName(tree, nme.apply) + def stabilize0(pre: Type): Tree = stabilize(adapted, pre, EXPRmode | QUALmode, WildcardType) + // TODO reconcile the overlap between Typers#stablize and TreeGen.stabilize + val qual = adapted match { + case This(_) => + gen.stabilize(adapted) + case Ident(_) => + val owner = adapted.symbol.owner + val pre = + if (owner.isPackageClass) owner.thisType + else if (owner.isClass) context.enclosingSubClassContext(owner).prefix + else NoPrefix + stabilize0(pre) + case Select(qualqual, _) => + stabilize0(qualqual.tpe) case other => other } |