summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-02-01 13:32:48 -0800
committerJames Iry <jamesiry@gmail.com>2013-02-01 13:32:48 -0800
commit283924bfa5c266ccaea1bdb87521581e1ceb38cd (patch)
tree688cb14ae0e4428be194214a775a72057cf174f5 /src
parentcabf626bbc49a897e581fbf6ceaa79ffb191bfec (diff)
parent11ac963c811f2a9a00fac5bb874efeaab35c4041 (diff)
downloadscala-283924bfa5c266ccaea1bdb87521581e1ceb38cd.tar.gz
scala-283924bfa5c266ccaea1bdb87521581e1ceb38cd.tar.bz2
scala-283924bfa5c266ccaea1bdb87521581e1ceb38cd.zip
Merge pull request #1979 from retronym/backport/1499
[backport] Fix for SI-6206, inconsistency with apply.
Diffstat (limited to 'src')
-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 a68a084d8f..b1e6b8b00a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1052,15 +1052,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
}