summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-01 09:10:45 -0700
committerPaul Phillips <paulp@improving.org>2012-10-13 17:57:17 -0700
commit267650cf9c3b07e360a59f3c5b70b37fea9de453 (patch)
tree706f9f2a8527467b75069fe561dca1746211112c /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentdf88808f8e34f23338956d736a6939d73c6af611 (diff)
downloadscala-267650cf9c3b07e360a59f3c5b70b37fea9de453.tar.gz
scala-267650cf9c3b07e360a59f3c5b70b37fea9de453.tar.bz2
scala-267650cf9c3b07e360a59f3c5b70b37fea9de453.zip
Fix for SI-6206, inconsistency with apply.
The code part of this patch is 100% written by retronym, who apparently has higher standards than I do because I found it just lying around in his repository. I think I'll go pick through his trash and see if he's throwing away any perfectly good muffins. I made the test case more exciting so as to feel useful.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala24
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
}