diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-09-17 10:15:15 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-09-17 10:15:15 -0700 |
commit | 66603a2c003852d39faec20a9763fb0e25049cf4 (patch) | |
tree | 0939e2ca36fe2f678d09209605c00b2b0d3f89f4 /src | |
parent | cc94a21b694e132c945eafa9022b3a6e19e804fb (diff) | |
parent | dbe7ef94dd5ea031b1d9e65a6843ff2ff5b28fe5 (diff) | |
download | scala-66603a2c003852d39faec20a9763fb0e25049cf4.tar.gz scala-66603a2c003852d39faec20a9763fb0e25049cf4.tar.bz2 scala-66603a2c003852d39faec20a9763fb0e25049cf4.zip |
Merge pull request #1321 from namin/apply-dynamic-sugar
Fixed SI-6353: applyDynamic with sugared applications
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index ce1c6089fb..089245e124 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1107,10 +1107,12 @@ trait Typers extends Modes with Adaptations with Tags { case _ => def applyPossible = { def applyMeth = member(adaptToName(tree, nme.apply), nme.apply) - if ((mode & TAPPmode) != 0) - tree.tpe.typeParams.isEmpty && applyMeth.filter(!_.tpe.typeParams.isEmpty) != NoSymbol - else - applyMeth.filter(_.tpe.paramSectionCount > 0) != NoSymbol + dyna.acceptsApplyDynamic(tree.tpe) || ( + if ((mode & TAPPmode) != 0) + tree.tpe.typeParams.isEmpty && applyMeth.filter(!_.tpe.typeParams.isEmpty) != NoSymbol + else + applyMeth.filter(_.tpe.paramSectionCount > 0) != NoSymbol + ) } if (tree.isType) adaptType() @@ -3845,11 +3847,15 @@ trait Typers extends Modes with Adaptations with Tags { } @inline def hasNamedArg(as: List[Tree]) = as.collectFirst{case AssignOrNamedArg(lhs, rhs) =>}.nonEmpty + def desugaredApply = tree match { + case Select(`qual`, nme.apply) => true + case _ => false + } // note: context.tree includes at most one Apply node // thus, we can't use it to detect we're going to receive named args in expressions such as: // qual.sel(a)(a2, arg2 = "a2") val oper = outer match { - case Apply(`tree`, as) => + case Apply(q, as) if q == tree || desugaredApply => val oper = if (hasNamedArg(as)) nme.applyDynamicNamed else nme.applyDynamic |