summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala4
-rw-r--r--test/files/neg/checksensibleUnit.check4
-rw-r--r--test/files/neg/infix-op-positions.check7
-rw-r--r--test/files/neg/infix-op-positions.scala4
-rw-r--r--test/files/neg/migration28.check4
-rw-r--r--test/files/neg/overload-msg.check2
-rw-r--r--test/files/neg/t1215.check2
-rw-r--r--test/files/neg/t3774.check2
-rw-r--r--test/files/neg/t3776.check2
9 files changed, 21 insertions, 10 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)
diff --git a/test/files/neg/checksensibleUnit.check b/test/files/neg/checksensibleUnit.check
index 1de1aa8031..7fed4e558a 100644
--- a/test/files/neg/checksensibleUnit.check
+++ b/test/files/neg/checksensibleUnit.check
@@ -1,7 +1,7 @@
checksensibleUnit.scala:3: error: value > is not a member of Unit
println((c = 1) > 0)
- ^
+ ^
checksensibleUnit.scala:4: error: value <= is not a member of Unit
println((c = 1) <= 0)
- ^
+ ^
two errors found
diff --git a/test/files/neg/infix-op-positions.check b/test/files/neg/infix-op-positions.check
new file mode 100644
index 0000000000..1bff9b941a
--- /dev/null
+++ b/test/files/neg/infix-op-positions.check
@@ -0,0 +1,7 @@
+infix-op-positions.scala:2: error: value -! is not a member of Option[Int]
+ Option(1) -! "test" // left associative operator
+ ^
+infix-op-positions.scala:3: error: value -!: is not a member of Option[Int]
+ "test" -!: Option(1) // right associative operators
+ ^
+two errors found
diff --git a/test/files/neg/infix-op-positions.scala b/test/files/neg/infix-op-positions.scala
new file mode 100644
index 0000000000..16351b0ab3
--- /dev/null
+++ b/test/files/neg/infix-op-positions.scala
@@ -0,0 +1,4 @@
+object Test {
+ Option(1) -! "test" // left associative operator
+ "test" -!: Option(1) // right associative operators
+}
diff --git a/test/files/neg/migration28.check b/test/files/neg/migration28.check
index 4c8c58e0fd..4324cc0d0a 100644
--- a/test/files/neg/migration28.check
+++ b/test/files/neg/migration28.check
@@ -1,8 +1,8 @@
migration28.scala:5: error: method ++= in class Stack is deprecated: use pushAll
s ++= List(1,2,3)
- ^
+ ^
migration28.scala:7: error: method foreach in class Stack has changed semantics:
Stack iterator and foreach now traverse in FIFO order.
s foreach (_ => ())
- ^
+ ^
two errors found
diff --git a/test/files/neg/overload-msg.check b/test/files/neg/overload-msg.check
index 780830bff9..4562c9ec65 100644
--- a/test/files/neg/overload-msg.check
+++ b/test/files/neg/overload-msg.check
@@ -9,5 +9,5 @@ overload-msg.scala:3: error: overloaded method value + with alternatives:
(java.lang.String)java.lang.String
cannot be applied to (Int(in method f))
def f[Int](y: Int) = x + y
- ^
+ ^
one error found
diff --git a/test/files/neg/t1215.check b/test/files/neg/t1215.check
index 77a9304b48..1f9dd6bf38 100644
--- a/test/files/neg/t1215.check
+++ b/test/files/neg/t1215.check
@@ -1,4 +1,4 @@
t1215.scala:2: error: value += is not a member of Int
val x = 1 += 1
- ^
+ ^
one error found
diff --git a/test/files/neg/t3774.check b/test/files/neg/t3774.check
index d73166bff9..59c63c4ee8 100644
--- a/test/files/neg/t3774.check
+++ b/test/files/neg/t3774.check
@@ -3,5 +3,5 @@ t3774.scala:4: error: overloaded method value ++ with alternatives:
[B >: ((Int, Int), List[Int]),That](that: scala.collection.TraversableOnce[B])(implicit bf: scala.collection.generic.CanBuildFrom[scala.collection.immutable.Map[(Int, Int),List[Int]],B,That])That
cannot be applied to (scala.collection.immutable.IndexedSeq[((Int, Int), scala.collection.immutable.Range.Inclusive)])
Map[(Int,Int),List[Int]]() ++ (for(x <- 0 to 1 ; y <- 0 to 1) yield {(x,y)-> (0 to 1)})
- ^
+ ^
one error found
diff --git a/test/files/neg/t3776.check b/test/files/neg/t3776.check
index e8798df6f3..4a5284cf0f 100644
--- a/test/files/neg/t3776.check
+++ b/test/files/neg/t3776.check
@@ -1,4 +1,4 @@
t3776.scala:8: error: value someOperation is not a member of _$1
def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v
- ^
+ ^
one error found