summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t7292-deprecation.check12
-rw-r--r--test/files/neg/t7292-removal.check12
-rw-r--r--test/files/pos/t7433.flags1
-rw-r--r--test/files/pos/t7433.scala10
-rw-r--r--test/files/pos/t7584.scala11
-rw-r--r--test/files/run/literals.check2
-rw-r--r--test/files/run/richs.check1
-rw-r--r--test/files/run/t7439.check2
-rw-r--r--test/files/run/t7439/A_1.java3
-rw-r--r--test/files/run/t7439/B_1.java3
-rw-r--r--test/files/run/t7439/Test_2.scala32
-rw-r--r--test/files/run/t7569.check12
-rw-r--r--test/files/run/t7569.scala19
-rw-r--r--test/files/run/t7584.check6
-rw-r--r--test/files/run/t7584.flags1
-rw-r--r--test/files/run/t7584.scala14
16 files changed, 128 insertions, 13 deletions
diff --git a/test/files/neg/t7292-deprecation.check b/test/files/neg/t7292-deprecation.check
index c7e6111962..17f010dfdf 100644
--- a/test/files/neg/t7292-deprecation.check
+++ b/test/files/neg/t7292-deprecation.check
@@ -1,11 +1,11 @@
-t7292-deprecation.scala:2: warning: Octal escape literals are deprecated, use /u0000 instead.
- val chr1 = '/0'
+t7292-deprecation.scala:2: warning: Octal escape literals are deprecated, use \u0000 instead.
+ val chr1 = '\0'
^
-t7292-deprecation.scala:3: warning: Octal escape literals are deprecated, use /u0053 instead.
- val str1 = "abc/123456"
+t7292-deprecation.scala:3: warning: Octal escape literals are deprecated, use \u0053 instead.
+ val str1 = "abc\123456"
^
-t7292-deprecation.scala:4: warning: Octal escape literals are deprecated, use /n instead.
- val lf = '/012'
+t7292-deprecation.scala:4: warning: Octal escape literals are deprecated, use \n instead.
+ val lf = '\012'
^
error: No warnings can be incurred under -Xfatal-warnings.
three warnings found
diff --git a/test/files/neg/t7292-removal.check b/test/files/neg/t7292-removal.check
index fffd0a1104..1cd59b0992 100644
--- a/test/files/neg/t7292-removal.check
+++ b/test/files/neg/t7292-removal.check
@@ -1,10 +1,10 @@
-t7292-removal.scala:2: error: Octal escape literals are unsupported, use /u0000 instead.
- val chr1 = '/0'
+t7292-removal.scala:2: error: Octal escape literals are unsupported, use \u0000 instead.
+ val chr1 = '\0'
^
-t7292-removal.scala:3: error: Octal escape literals are unsupported, use /u0053 instead.
- val str1 = "abc/123456"
+t7292-removal.scala:3: error: Octal escape literals are unsupported, use \u0053 instead.
+ val str1 = "abc\123456"
^
-t7292-removal.scala:4: error: Octal escape literals are unsupported, use /n instead.
- val lf = '/012'
+t7292-removal.scala:4: error: Octal escape literals are unsupported, use \n instead.
+ val lf = '\012'
^
three errors found
diff --git a/test/files/pos/t7433.flags b/test/files/pos/t7433.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t7433.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7433.scala b/test/files/pos/t7433.scala
new file mode 100644
index 0000000000..f2109f4afa
--- /dev/null
+++ b/test/files/pos/t7433.scala
@@ -0,0 +1,10 @@
+object Test {
+ def foo() {
+ try {
+ for (i <- 1 until 5) return
+ } catch {
+ case _: NullPointerException | _: RuntimeException =>
+ // was: "catch block may intercept non-local return from method check"
+ }
+ }
+}
diff --git a/test/files/pos/t7584.scala b/test/files/pos/t7584.scala
new file mode 100644
index 0000000000..52d127ecb9
--- /dev/null
+++ b/test/files/pos/t7584.scala
@@ -0,0 +1,11 @@
+object Test {
+ def fold[A, B](f: (A, => B) => B) = ???
+ def f[A, B](x: A, y: B): B = ???
+ def bip[A, B] = fold[A, B]((x, y) => f(x, y))
+ def bop[A, B] = fold[A, B](f)
+
+ // these work:
+ fold[Int, Int]((x, y) => f(x, y))
+ fold[Int, Int](f)
+}
+
diff --git a/test/files/run/literals.check b/test/files/run/literals.check
index 6be5137994..5f948762b7 100644
--- a/test/files/run/literals.check
+++ b/test/files/run/literals.check
@@ -1,4 +1,4 @@
-warning: there were 13 deprecation warning(s); re-run with -deprecation for details
+warning: there were 18 deprecation warning(s); re-run with -deprecation for details
test '\u0024' == '$' was successful
test '\u005f' == '_' was successful
test 65.asInstanceOf[Char] == 'A' was successful
diff --git a/test/files/run/richs.check b/test/files/run/richs.check
index a970a814b1..02a98b376d 100644
--- a/test/files/run/richs.check
+++ b/test/files/run/richs.check
@@ -1,3 +1,4 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
RichCharTest1:
true
diff --git a/test/files/run/t7439.check b/test/files/run/t7439.check
new file mode 100644
index 0000000000..9ea09f9c40
--- /dev/null
+++ b/test/files/run/t7439.check
@@ -0,0 +1,2 @@
+Recompiling after deleting t7439-run.obj/A_1.class
+pos: NoPosition Class A_1 not found - continuing with a stub. WARNING
diff --git a/test/files/run/t7439/A_1.java b/test/files/run/t7439/A_1.java
new file mode 100644
index 0000000000..4accd95d57
--- /dev/null
+++ b/test/files/run/t7439/A_1.java
@@ -0,0 +1,3 @@
+public class A_1 {
+
+} \ No newline at end of file
diff --git a/test/files/run/t7439/B_1.java b/test/files/run/t7439/B_1.java
new file mode 100644
index 0000000000..5dd3b93d6f
--- /dev/null
+++ b/test/files/run/t7439/B_1.java
@@ -0,0 +1,3 @@
+public class B_1 {
+ public void b(A_1[] a) {}
+}
diff --git a/test/files/run/t7439/Test_2.scala b/test/files/run/t7439/Test_2.scala
new file mode 100644
index 0000000000..3ebbcfe753
--- /dev/null
+++ b/test/files/run/t7439/Test_2.scala
@@ -0,0 +1,32 @@
+import scala.tools.partest._
+import java.io.File
+
+object Test extends StoreReporterDirectTest {
+ def code = ???
+
+ def compileCode(code: String) = {
+ val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
+ compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code)
+ }
+
+ def C = """
+ class C {
+ new B_1
+ }
+ """
+
+ def show(): Unit = {
+ //compileCode(C)
+ assert(filteredInfos.isEmpty, filteredInfos)
+
+ // blow away the entire package
+ val a1Class = new File(testOutput.path, "A_1.class")
+ assert(a1Class.exists)
+ assert(a1Class.delete())
+ println(s"Recompiling after deleting $a1Class")
+
+ // bad symbolic reference error expected (but no stack trace!)
+ compileCode(C)
+ println(storeReporter.infos.mkString("\n")) // Included a NullPointerException before.
+ }
+}
diff --git a/test/files/run/t7569.check b/test/files/run/t7569.check
new file mode 100644
index 0000000000..98513c3ab2
--- /dev/null
+++ b/test/files/run/t7569.check
@@ -0,0 +1,12 @@
+source-newSource1.scala,line-3,offset=49 A.this.one
+source-newSource1.scala,line-3,offset=49 A.this
+source-newSource1.scala,line-4,offset=67 A.super.<init>()
+source-newSource1.scala,line-4,offset=67 A.super.<init>
+source-newSource1.scala,line-4,offset=67 this
+source-newSource1.scala,line-3,offset=49 A.this.one
+source-newSource1.scala,line-3,offset=49 A.this
+RangePosition(newSource1.scala, 55, 57, 65) scala.Int.box(1).toString()
+RangePosition(newSource1.scala, 55, 57, 65) scala.Int.box(1).toString
+RangePosition(newSource1.scala, 55, 55, 56) scala.Int.box(1)
+NoPosition scala.Int.box
+NoPosition scala.Int
diff --git a/test/files/run/t7569.scala b/test/files/run/t7569.scala
new file mode 100644
index 0000000000..b1b1443a18
--- /dev/null
+++ b/test/files/run/t7569.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest._
+object Test extends CompilerTest {
+ import global._
+ override def extraSettings = super.extraSettings + " -Yrangepos"
+ override def sources = List(
+ """|import scala.language.postfixOps
+ |class A {
+ | val one = 1 toString
+ |}""".stripMargin
+ )
+ def check(source: String, unit: CompilationUnit) {
+ for (ClassDef(_, _, _, Template(_, _, stats)) <- unit.body ; stat <- stats ; t <- stat) {
+ t match {
+ case _: Select | _ : Apply | _:This => println("%-15s %s".format(t.pos.toString, t))
+ case _ =>
+ }
+ }
+ }
+}
diff --git a/test/files/run/t7584.check b/test/files/run/t7584.check
new file mode 100644
index 0000000000..9f53e5dde5
--- /dev/null
+++ b/test/files/run/t7584.check
@@ -0,0 +1,6 @@
+no calls
+call A
+a
+call B twice
+b
+b
diff --git a/test/files/run/t7584.flags b/test/files/run/t7584.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/run/t7584.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/run/t7584.scala b/test/files/run/t7584.scala
new file mode 100644
index 0000000000..6d7f4f7ebb
--- /dev/null
+++ b/test/files/run/t7584.scala
@@ -0,0 +1,14 @@
+// Test case added to show the behaviour of functions with
+// by-name parameters. The evaluation behaviour was already correct.
+//
+// We did flush out a spurious "pure expression does nothing in statement position"
+// warning, hence -Xfatal-warnings in the flags file.
+object Test extends App {
+ def foo(f: (=> Int, => Int) => Unit) = f({println("a"); 0}, {println("b"); 1})
+ println("no calls")
+ foo((a, b) => ())
+ println("call A")
+ foo((a, b) => a)
+ println("call B twice")
+ foo((a, b) => {b; b})
+}