- ^
+ ^
t4069.scala:10: error: '}' expected but eof found.
}
^
diff --git a/test/files/neg/t5702-neg-ugly-xbrace.check b/test/files/neg/t5702-neg-ugly-xbrace.check
index 768bff0f4155..7231bcf902a3 100644
--- a/test/files/neg/t5702-neg-ugly-xbrace.check
+++ b/test/files/neg/t5702-neg-ugly-xbrace.check
@@ -9,7 +9,7 @@ t5702-neg-ugly-xbrace.scala:13: error: in XML literal: in XML content, please us
^
t5702-neg-ugly-xbrace.scala:11: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed
val {a, z@_*) = xml
- ^
+ ^
t5702-neg-ugly-xbrace.scala:14: error: illegal start of simple pattern
}
^
diff --git a/test/files/neg/xmltruncated7.check b/test/files/neg/xmltruncated7.check
index c8d72a686775..85b919c9a604 100644
--- a/test/files/neg/xmltruncated7.check
+++ b/test/files/neg/xmltruncated7.check
@@ -3,5 +3,5 @@ xmltruncated7.scala:2: error: in XML literal: in XML content, please use '}}' to
^
xmltruncated7.scala:2: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed
foo}:
- ^
+ ^
2 errors
diff --git a/test/files/run/infixPostfixAttachments.check b/test/files/run/infixPostfixAttachments.check
new file mode 100644
index 000000000000..a4842a4a25e2
--- /dev/null
+++ b/test/files/run/infixPostfixAttachments.check
@@ -0,0 +1,17 @@
+newSource1.scala:15: warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method d,
+or remove the empty argument list from its definition (Java-defined methods are exempt).
+In Scala 3, an unapplied method like this will be eta-expanded into a function.
+ def t6 = this d
+ ^
+newSource1.scala:16: warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method d,
+or remove the empty argument list from its definition (Java-defined methods are exempt).
+In Scala 3, an unapplied method like this will be eta-expanded into a function.
+ def t7 = this.d
+ ^
+t1 this.a(0) List(InfixAttachment)
+t2 this.b(scala.Tuple2.apply[Int, Int](1, 2)).b(scala.Tuple2.apply[Int, Int](1, 2)).c(1, 2) List(InfixAttachment, MultiargInfixAttachment)
+t2 this.b(scala.Tuple2.apply[Int, Int](1, 2)).b(scala.Tuple2.apply[Int, Int](1, 2)) List(InfixAttachment)
+t2 this.b(scala.Tuple2.apply[Int, Int](1, 2)) List(InfixAttachment)
+t6 this.d() List(InfixAttachment)
+t6 this.d List(PostfixAttachment)
+t8 this.e List(PostfixAttachment)
diff --git a/test/files/run/infixPostfixAttachments.scala b/test/files/run/infixPostfixAttachments.scala
new file mode 100644
index 000000000000..a5505a456b5b
--- /dev/null
+++ b/test/files/run/infixPostfixAttachments.scala
@@ -0,0 +1,37 @@
+import scala.tools.partest._
+
+object Test extends CompilerTest {
+ import global._
+ override def extraSettings = super.extraSettings + " -Yrangepos -Ystop-after:typer -deprecation"
+
+ override def code =
+ """class C {
+ | import scala.language.postfixOps
+ |
+ | def a(x: Any) = this
+ | def b(x: (Any, Any)) = this
+ | def c(x: Any, y: Any) = this
+ | def d() = this
+ | def e = this
+ |
+ | def t1 = this a 0
+ | def t2 = this b (1, 2) b ((1, 2)) c (1, 2)
+ | def t3 = this.b(1, 2).b((1, 2)).c(1, 2)
+ | // def t4 = this d () // not allowed in 2.13
+ | def t5 = this.d()
+ | def t6 = this d
+ | def t7 = this.d
+ | def t8 = this e
+ | def t9 = this.e
+ |}
+ |""".stripMargin
+
+ def check(source: String, unit: CompilationUnit): Unit = unit.body foreach {
+ case dd: DefDef if dd.name.startsWith("t") =>
+ dd.rhs.foreach(t => {
+ if (!t.attachments.isEmpty)
+ println(s"${dd.symbol.name} $t ${t.attachments.all.toList.sortBy(_.toString)}")
+ })
+ case _ =>
+ }
+}
diff --git a/test/files/run/t12597.check b/test/files/run/t12597.check
new file mode 100644
index 000000000000..59f68a938017
--- /dev/null
+++ b/test/files/run/t12597.check
@@ -0,0 +1,10 @@
+List((26,30))
+List((26,33))
+List((26,42), (26,33))
+List((26,44), (27,34))
+List((26,46), (28,35))
+List((26,37), (26,26), (26,33), (33,37))
+List((26,46), (26,37), (26,26), (26,33), (33,37))
+List((26,36), (26,27))
+List((26,36), (26,27))
+List((26,51), (26,42), (28,37), (36,37), (39,40))
diff --git a/test/files/run/t12597.scala b/test/files/run/t12597.scala
new file mode 100644
index 000000000000..f3e75da8e848
--- /dev/null
+++ b/test/files/run/t12597.scala
@@ -0,0 +1,31 @@
+import scala.tools.partest._
+import scala.collection.mutable.LinkedHashMap
+
+object Test extends CompilerTest {
+ import global._
+ override def extraSettings = super.extraSettings + " -Yrangepos -Ystop-after:parser"
+ val tests = List(
+ "class A1 { def t = }",
+ "class A2 { def t = }",
+ "class A3 { def t = .toString }",
+ "class A4 { def t = ().toString }",
+ "class A5 { def t = { }.toString }",
+ "class A6 { def t = }",
+ "class A7 { def t = .toString }",
+ "class B1 { def t(c: A1) = c.toString }",
+ "class B2 { def t(c: A1) = c toString }",
+ "class B3 { def t(c: A1) = { val x = c; x }.toString }",
+ // ^ 26 ^ 36
+ )
+
+ override def sources = tests
+
+ def check(source: String, unit: CompilationUnit): Unit = unit.body foreach {
+ case dd: DefDef if dd.name.startsWith("t") =>
+ val poss = dd.rhs.collect {
+ case t if t.pos != NoPosition => (t.pos.start, t.pos.end)
+ }.distinct
+ println(poss)
+ case _ =>
+ }
+}
diff --git a/test/files/run/t3368-b.check b/test/files/run/t3368-b.check
index 4cbe98c577f5..8a079eae516e 100644
--- a/test/files/run/t3368-b.check
+++ b/test/files/run/t3368-b.check
@@ -15,34 +15,18 @@ package {
def $init$() = {
()
};
- def y = {
- {
- new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus({
- {
- new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)
- }
- });
- $buf.$amp$plus(new _root_.scala.xml.Text("start"));
- $buf.$amp$plus(new _root_.scala.xml.PCData("hi & bye"));
- $buf.$amp$plus({
- {
- new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true)
- }
- });
- $buf.$amp$plus(new _root_.scala.xml.Text("world"));
- $buf.$amp$plus({
- {
- new _root_.scala.xml.Elem(null, "d", _root_.scala.xml.Null, $scope, true)
- }
- });
- $buf.$amp$plus(new _root_.scala.xml.Text("stuff"));
- $buf.$amp$plus(new _root_.scala.xml.PCData("red & black"));
- $buf
- }: _*))
- }
- }
+ def y = new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Text("start"));
+ $buf.$amp$plus(new _root_.scala.xml.PCData("hi & bye"));
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Text("world"));
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "d", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Text("stuff"));
+ $buf.$amp$plus(new _root_.scala.xml.PCData("red & black"));
+ $buf
+ }: _*))
};
abstract trait Z extends scala.AnyRef {
def $init$() = {
@@ -55,35 +39,23 @@ package {
$buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
$buf
};
- def f = {
- {
- new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus(new _root_.scala.xml.Text("x"));
- $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
- $buf
- }: _*))
- }
- };
- def g = {
- {
- new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
- $buf
- }: _*))
- }
- };
- def h = {
- {
- new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
- $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
- $buf
- }: _*))
- }
- }
+ def f = new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Text("x"));
+ $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
+ $buf
+ }: _*));
+ def g = new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
+ $buf
+ }: _*));
+ def h = new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
+ $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world"));
+ $buf
+ }: _*))
}
}
diff --git a/test/files/run/t3368.check b/test/files/run/t3368.check
index e0c10cc0ddb2..ee95d0242798 100644
--- a/test/files/run/t3368.check
+++ b/test/files/run/t3368.check
@@ -15,32 +15,16 @@ package {
def $init$() = {
()
};
- def y = {
- {
- new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus({
- {
- new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)
- }
- });
- $buf.$amp$plus(new _root_.scala.xml.Text("starthi & bye"));
- $buf.$amp$plus({
- {
- new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true)
- }
- });
- $buf.$amp$plus(new _root_.scala.xml.Text("world"));
- $buf.$amp$plus({
- {
- new _root_.scala.xml.Elem(null, "d", _root_.scala.xml.Null, $scope, true)
- }
- });
- $buf.$amp$plus(new _root_.scala.xml.Text("stuffred & black"));
- $buf
- }: _*))
- }
- }
+ def y = new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Text("starthi & bye"));
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Text("world"));
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "d", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Text("stuffred & black"));
+ $buf
+ }: _*))
};
abstract trait Z extends scala.AnyRef {
def $init$() = {
@@ -53,33 +37,21 @@ package {
$buf.$amp$plus(new _root_.scala.xml.Text("hello, world"));
$buf
};
- def f = {
- {
- new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus(new _root_.scala.xml.Text("xhello, world"));
- $buf
- }: _*))
- }
- };
- def g = {
- {
- new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus(new _root_.scala.xml.Text("hello, world"));
- $buf
- }: _*))
- }
- };
- def h = {
- {
- new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
- val $buf = new _root_.scala.xml.NodeBuffer();
- $buf.$amp$plus(new _root_.scala.xml.Text("hello, worldhello, world"));
- $buf
- }: _*))
- }
- }
+ def f = new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Text("xhello, world"));
+ $buf
+ }: _*));
+ def g = new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Text("hello, world"));
+ $buf
+ }: _*));
+ def h = new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Text("hello, worldhello, world"));
+ $buf
+ }: _*))
}
}
diff --git a/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala b/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala
index 48b8b7f1647f..6404ba5f8ca6 100644
--- a/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala
+++ b/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala
@@ -24,7 +24,7 @@ object Delambdafy {
}
println(result)
lazy val _foo = foo(result) {
- case x :: xs if x isDefined => x.get.length
+ case x :: xs if x.isDefined => x.get.length
case _ => 0
}
println(_foo)
diff --git a/test/scalacheck/redblacktree.scala b/test/scalacheck/redblacktree.scala
index 02c7597548b3..328da422cc5c 100644
--- a/test/scalacheck/redblacktree.scala
+++ b/test/scalacheck/redblacktree.scala
@@ -202,8 +202,8 @@ object TestRange extends RedBlackTreeTest("RedBlackTree.range") {
property("range boundaries respected") = forAll(genInput) { case (tree, parm, newTree) =>
val from = parm._1 flatMap (nodeAt(tree, _) map (_._1))
val to = parm._2 flatMap (nodeAt(tree, _) map (_._1))
- ("lower boundary" |: (from forall ( key => keysIterator(newTree) forall (key <=)))) &&
- ("upper boundary" |: (to forall ( key => keysIterator(newTree) forall (key >))))
+ ("lower boundary" |: (from forall ( key => keysIterator(newTree) forall (key.<=)))) &&
+ ("upper boundary" |: (to forall ( key => keysIterator(newTree) forall (key.>))))
}
property("range returns all elements") = forAll(genInput) { case (tree, parm, newTree) =>