summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-09-15 23:13:53 +0000
committerPaul Phillips <paulp@improving.org>2010-09-15 23:13:53 +0000
commitb094defe6162232d8be29ae0eb44ab6742c11f9b (patch)
treeff2432ecfb17c84c3bbc1eef116510c2a5b1df64 /src
parentf78d8f648e7c5d4bd0102a03be3e6c8479146e39 (diff)
downloadscala-b094defe6162232d8be29ae0eb44ab6742c11f9b.tar.gz
scala-b094defe6162232d8be29ae0eb44ab6742c11f9b.tar.bz2
scala-b094defe6162232d8be29ae0eb44ab6742c11f9b.zip
positioning fix for infix expressions: report e...
positioning fix for infix expressions: report error at the operator instead of at the receiver of a binop In general use the operator position as the Select position's point instead of the left or right expression. Position.union always uses the receiver's point as point of the result, so swapping fixes that. See http://www.scala-lang.org/node/6912 for the report.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 9f20a70de5..fc2fe6f2a5 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -163,12 +163,12 @@ abstract class TreeBuilder {
}
if (isExpr) {
if (treeInfo.isLeftAssoc(op)) {
- Apply(atPos(left.pos union opPos) { Select(stripParens(left), op.encode) }, arguments)
+ Apply(atPos(opPos union left.pos) { Select(stripParens(left), op.encode) }, arguments)
} else {
val x = freshName()
Block(
List(ValDef(Modifiers(SYNTHETIC), x, TypeTree(), stripParens(left))),
- Apply(atPos(right.pos union opPos) { Select(stripParens(right), op.encode) }, List(Ident(x))))
+ Apply(atPos(opPos union right.pos) { Select(stripParens(right), op.encode) }, List(Ident(x))))
}
} else {
Apply(Ident(op.encode), stripParens(left) :: arguments)