diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t7433.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t7433.scala | 10 | ||||
-rw-r--r-- | test/files/pos/t7584.scala | 11 | ||||
-rw-r--r-- | test/files/run/t5603.scala | 2 | ||||
-rw-r--r-- | test/files/run/t6308.scala | 20 | ||||
-rw-r--r-- | test/files/run/t6331.scala | 2 | ||||
-rw-r--r-- | test/files/run/t6331b.scala | 2 | ||||
-rw-r--r-- | test/files/run/t7271.scala | 2 | ||||
-rw-r--r-- | test/files/run/t7337.scala | 2 | ||||
-rw-r--r-- | test/files/run/t7439.check | 2 | ||||
-rw-r--r-- | test/files/run/t7439/A_1.java | 3 | ||||
-rw-r--r-- | test/files/run/t7439/B_1.java | 3 | ||||
-rw-r--r-- | test/files/run/t7439/Test_2.scala | 32 | ||||
-rw-r--r-- | test/files/run/t7569.check | 12 | ||||
-rw-r--r-- | test/files/run/t7569.scala | 19 | ||||
-rw-r--r-- | test/files/run/t7584.check | 6 | ||||
-rw-r--r-- | test/files/run/t7584.flags | 1 | ||||
-rw-r--r-- | test/files/run/t7584.scala | 14 | ||||
-rw-r--r-- | test/scaladoc/run/t5527.scala | 2 |
19 files changed, 132 insertions, 14 deletions
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/t5603.scala b/test/files/run/t5603.scala index 8c8038a602..77c2775cc3 100644 --- a/test/files/run/t5603.scala +++ b/test/files/run/t5603.scala @@ -1,7 +1,7 @@ import scala.tools.partest._ import java.io._ import scala.tools.nsc._ -import scala.tools.nsc.util.CommandLineParser +import scala.tools.cmd.CommandLineParser import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.ConsoleReporter diff --git a/test/files/run/t6308.scala b/test/files/run/t6308.scala index bcd89359b0..d23cd6e13e 100644 --- a/test/files/run/t6308.scala +++ b/test/files/run/t6308.scala @@ -1,21 +1,25 @@ import scala.{specialized => sp} +// NOTE: `{ val c = caller; print(""); c }` is used instead of a simple `caller`, +// because we want to prevent tail-call optimization from eliding the stack- +// frames we want to inspect. + object Test { def caller = new Exception().getStackTrace()(1).getMethodName - def f1[@sp(Int) A](a: A, b: Any) = caller - def f2[@sp(Int) A, B](a: A, b: String) = caller - def f3[B, @sp(Int) A](a: A, b: List[B]) = caller - def f4[B, @sp(Int) A](a: A, b: List[(A, B)]) = caller + def f1[@sp(Int) A](a: A, b: Any) = { val c = caller; print(""); c } + def f2[@sp(Int) A, B](a: A, b: String) = { val c = caller; print(""); c } + def f3[B, @sp(Int) A](a: A, b: List[B]) = { val c = caller; print(""); c } + def f4[B, @sp(Int) A](a: A, b: List[(A, B)]) = { val c = caller; print(""); c } - def f5[@sp(Int) A, B <: Object](a: A, b: B) = caller + def f5[@sp(Int) A, B <: Object](a: A, b: B) = { val c = caller; print(""); c } // `uncurryTreeType` calls a TypeMap on the call to this method and we end up with new // type parameter symbols, which are not found in `TypeEnv.includes(typeEnv(member), env)` // in `specSym`. (One of `uncurry`'s tasks is to expand type aliases in signatures.) type T = Object - def todo1[@sp(Int) A, B <: T](a: A, b: String) = caller - def todo2[@sp(Int) A, B <: AnyRef](a: A, b: String) = caller - def todo3[B <: List[A], @specialized(Int) A](a: A, b: B) = caller + def todo1[@sp(Int) A, B <: T](a: A, b: String) = { val c = caller; print(""); c } + def todo2[@sp(Int) A, B <: AnyRef](a: A, b: String) = { val c = caller; print(""); c } + def todo3[B <: List[A], @specialized(Int) A](a: A, b: B) = { val c = caller; print(""); c } def main(args: Array[String]) { val s = "" diff --git a/test/files/run/t6331.scala b/test/files/run/t6331.scala index 4e43a7686e..5ac627a8ea 100644 --- a/test/files/run/t6331.scala +++ b/test/files/run/t6331.scala @@ -1,7 +1,7 @@ import scala.tools.partest._ import java.io._ import scala.tools.nsc._ -import scala.tools.nsc.util.CommandLineParser +import scala.tools.cmd.CommandLineParser import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.ConsoleReporter diff --git a/test/files/run/t6331b.scala b/test/files/run/t6331b.scala index f966abea51..c567455c5c 100644 --- a/test/files/run/t6331b.scala +++ b/test/files/run/t6331b.scala @@ -1,7 +1,7 @@ import scala.tools.partest._ import java.io._ import scala.tools.nsc._ -import scala.tools.nsc.util.CommandLineParser +import scala.tools.cmd.CommandLineParser import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.ConsoleReporter diff --git a/test/files/run/t7271.scala b/test/files/run/t7271.scala index cb43331a29..55c388b7f5 100644 --- a/test/files/run/t7271.scala +++ b/test/files/run/t7271.scala @@ -1,7 +1,7 @@ import scala.tools.partest._ import java.io._ import scala.tools.nsc._ -import scala.tools.nsc.util.CommandLineParser +import scala.tools.cmd.CommandLineParser import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.ConsoleReporter import scala.reflect.internal.Positions diff --git a/test/files/run/t7337.scala b/test/files/run/t7337.scala index d878182ed0..9913f8ae45 100644 --- a/test/files/run/t7337.scala +++ b/test/files/run/t7337.scala @@ -1,6 +1,6 @@ import scala.tools.partest._ import scala.tools.nsc._ -import util.{CommandLineParser} +import scala.tools.cmd.CommandLineParser object Test extends DirectTest { override def code = "class C" 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}) +} diff --git a/test/scaladoc/run/t5527.scala b/test/scaladoc/run/t5527.scala index 60ae23c1a7..770d4ad13f 100644 --- a/test/scaladoc/run/t5527.scala +++ b/test/scaladoc/run/t5527.scala @@ -1,7 +1,7 @@ import scala.tools.partest._ import java.io._ import scala.tools.nsc._ -import scala.tools.nsc.util.CommandLineParser +import scala.tools.cmd.CommandLineParser import scala.tools.nsc.doc.{Settings, DocFactory} import scala.tools.nsc.reporters.ConsoleReporter |