summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorSimon Schaefer <mail@antoras.de>2013-11-24 00:01:25 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-26 19:01:32 +0100
commit696545d53f89d8a764273dacca5c6d3043911722 (patch)
tree6f38669a2d1d4081945e0a794359dc0839d6caf1 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentb915f440eb3738d2991b1f96b7c810cc87b88d0c (diff)
downloadscala-696545d53f89d8a764273dacca5c6d3043911722.tar.gz
scala-696545d53f89d8a764273dacca5c6d3043911722.tar.bz2
scala-696545d53f89d8a764273dacca5c6d3043911722.zip
SI-8004 Resolve NoPosition error for applyDynamicNamed method call
Previously, there were no positions created for the tuples that are generated while doing the transformation for an applyDynamicNamed call. This led to an NoPosition error in scalac when one tries to show position information in the AST. Furthermore, this simplifies semantic highlighting in the scala-ide because no position information for color ranges have to be created anymore.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 2bbb6d79dd..a18bc5ddcf 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3999,9 +3999,14 @@ trait Typers extends Modes with Adaptations with Tags {
def typedNamedApply(orig: Tree, fun: Tree, args: List[Tree], mode: Int, pt: Type): Tree = {
def argToBinding(arg: Tree): Tree = arg match {
- case AssignOrNamedArg(Ident(name), rhs) => gen.mkTuple(List(CODE.LIT(name.toString), rhs))
- case _ => gen.mkTuple(List(CODE.LIT(""), arg))
+ case AssignOrNamedArg(i @ Ident(name), rhs) =>
+ atPos(i.pos.withEnd(rhs.pos.endOrPoint)) {
+ gen.mkTuple(List(atPos(i.pos)(CODE.LIT(name.toString)), rhs))
+ }
+ case _ =>
+ gen.mkTuple(List(CODE.LIT(""), arg))
}
+
val t = treeCopy.Apply(orig, fun, args map argToBinding)
wrapErrors(t, _.typed(t, mode, pt))
}