summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-14 23:29:50 -0800
committerPaul Phillips <paulp@improving.org>2013-01-26 11:19:36 -0800
commit801eab55019c433d2fa6a925d02e41b1c47cbf22 (patch)
tree2b7d5351cb87a9b20a02b3f09ea05c00e8c88dbc /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent832fc9a67e5aa85bdde61883527d3ac9554094d7 (diff)
downloadscala-801eab55019c433d2fa6a925d02e41b1c47cbf22.tar.gz
scala-801eab55019c433d2fa6a925d02e41b1c47cbf22.tar.bz2
scala-801eab55019c433d2fa6a925d02e41b1c47cbf22.zip
SI-5182, no position on annotation error.
Now there's a position on the synthetic "value" Ident.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index c12233b726..162bdd22b2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -117,6 +117,10 @@ trait Typers extends Adaptations with Tags {
}
}
+ private def mkNamedArg(tree: Tree, name: Name): Tree = {
+ atPos(tree.pos)(new AssignOrNamedArg(Ident(name), tree))
+ }
+
/** Find implicit arguments and pass them to given tree.
*/
def applyImplicitArgs(fun: Tree): Tree = fun.tpe match {
@@ -128,7 +132,6 @@ trait Typers extends Adaptations with Tags {
var paramFailed = false
def mkPositionalArg(argTree: Tree, paramName: Name) = argTree
- def mkNamedArg(argTree: Tree, paramName: Name) = atPos(argTree.pos)(new AssignOrNamedArg(Ident(paramName), (argTree)))
var mkArg: (Tree, Name) => Tree = mkPositionalArg
// DEPMETTODO: instantiate type vars that depend on earlier implicit args (see adapt (4.1))
@@ -3459,7 +3462,7 @@ trait Typers extends Adaptations with Tags {
// begin typedAnnotation
val treeInfo.Applied(fun0, targs, argss) = treeInfo.dissectApplied(ann)
- val typedFun0 = typed(fun0, forFunMode(mode), WildcardType)
+ val typedFun0 = typed(fun0, mode.forFunMode, WildcardType)
val typedFunPart = (
// If there are dummy type arguments in typeFun part, it suggests we
// must type the actual constructor call, not only the select. The value
@@ -3486,13 +3489,11 @@ trait Typers extends Adaptations with Tags {
val annScope = annType.decls
.filter(sym => sym.isMethod && !sym.isConstructor && sym.isJavaDefined)
val names = new scala.collection.mutable.HashSet[Symbol]
- def hasValue = names exists (_.name == nme.value)
names ++= (if (isJava) annScope.iterator
else typedFun.tpe.params.iterator)
val args = argss match {
- case List(List(arg)) if !isNamed(arg) && hasValue =>
- List(new AssignOrNamedArg(Ident(nme.value), arg))
- case as :: _ => as
+ case (arg :: Nil) :: Nil if !isNamed(arg) => mkNamedArg(arg, nme.value) :: Nil
+ case args :: Nil => args
}
val nvPairs = args map {