summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bcodeInlinerMixed.flags1
-rw-r--r--test/files/run/bcodeInlinerMixed/A_1.java3
-rw-r--r--test/files/run/bcodeInlinerMixed/B_1.scala20
-rw-r--r--test/files/run/bcodeInlinerMixed/Test.scala16
-rw-r--r--test/files/run/colltest1.scala2
-rw-r--r--test/files/run/compiler-asSeenFrom.scala2
-rw-r--r--test/files/run/existentials-in-compiler.scala2
-rw-r--r--test/files/run/is-valid-num.scala2
-rw-r--r--test/files/run/iterator-from.scala2
-rw-r--r--test/files/run/mapConserve.scala2
-rw-r--r--test/files/run/pc-conversions.scala2
-rw-r--r--test/files/run/stringinterpolation_macro-run.scala2
-rw-r--r--test/files/run/synchronized.check4
-rw-r--r--test/files/run/t7096.scala2
-rw-r--r--test/files/run/t7582.check4
-rw-r--r--test/files/run/t7582b.check4
-rw-r--r--test/files/run/t7974.check23
-rw-r--r--test/files/run/t7974/Test.scala14
-rw-r--r--test/files/run/t9219.check3
-rw-r--r--test/files/run/t9219.scala11
-rw-r--r--test/files/run/t9223.scala8
-rw-r--r--test/files/run/t9223b.scala8
22 files changed, 101 insertions, 36 deletions
diff --git a/test/files/run/bcodeInlinerMixed.flags b/test/files/run/bcodeInlinerMixed.flags
new file mode 100644
index 0000000000..63b5558cfd
--- /dev/null
+++ b/test/files/run/bcodeInlinerMixed.flags
@@ -0,0 +1 @@
+-Ybackend:GenBCode -Yopt:l:classpath \ No newline at end of file
diff --git a/test/files/run/bcodeInlinerMixed/A_1.java b/test/files/run/bcodeInlinerMixed/A_1.java
new file mode 100644
index 0000000000..44d7d88eeb
--- /dev/null
+++ b/test/files/run/bcodeInlinerMixed/A_1.java
@@ -0,0 +1,3 @@
+public class A_1 {
+ public static final int bar() { return 100; }
+}
diff --git a/test/files/run/bcodeInlinerMixed/B_1.scala b/test/files/run/bcodeInlinerMixed/B_1.scala
new file mode 100644
index 0000000000..2aadeccb82
--- /dev/null
+++ b/test/files/run/bcodeInlinerMixed/B_1.scala
@@ -0,0 +1,20 @@
+// Partest does proper mixed compilation:
+// 1. scalac *.scala *.java
+// 2. javac *.java
+// 3. scalc *.scala
+//
+// In the second scalc round, the classfile for A_1 is on the classpath.
+// Therefore the inliner has access to the bytecode of `bar`, which means
+// it can verify that the invocation to `bar` can be safely inlined.
+//
+// So both callsites of `flop` are inlined.
+//
+// In a single mixed compilation, `flop` cannot be inlined, see JUnit InlinerTest.scala, def mixedCompilationNoInline.
+
+class B {
+ @inline final def flop = A_1.bar
+ def g = flop
+}
+class C {
+ def h(b: B) = b.flop
+}
diff --git a/test/files/run/bcodeInlinerMixed/Test.scala b/test/files/run/bcodeInlinerMixed/Test.scala
new file mode 100644
index 0000000000..c8c7a9fe2a
--- /dev/null
+++ b/test/files/run/bcodeInlinerMixed/Test.scala
@@ -0,0 +1,16 @@
+import scala.tools.partest.{BytecodeTest, ASMConverters}
+import ASMConverters._
+
+object Test extends BytecodeTest {
+ def show: Unit = {
+ val gIns = instructionsFromMethod(getMethod(loadClassNode("B"), "g"))
+ val hIns = instructionsFromMethod(getMethod(loadClassNode("C"), "h"))
+ // val invocation = Invoke(INVOKESTATIC, A_1, bar, ()I, false)
+ for (i <- List(gIns, hIns)) {
+ assert(i exists {
+ case Invoke(_, _, "bar", "()I", _) => true
+ case _ => false
+ }, i mkString "\n")
+ }
+ }
+}
diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala
index e0ec378585..de8780a050 100644
--- a/test/files/run/colltest1.scala
+++ b/test/files/run/colltest1.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warnings; re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with
*/
import scala.collection._
import scala.language.postfixOps
diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala
index 677dd40ddc..a60c2e8925 100644
--- a/test/files/run/compiler-asSeenFrom.scala
+++ b/test/files/run/compiler-asSeenFrom.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning; re-run with -Yinline-warnings for details
+ * filter: inliner warning; re-run with
*/
import scala.tools.nsc._
import scala.tools.partest.DirectTest
diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala
index dfc7048b31..e516eddf95 100644
--- a/test/files/run/existentials-in-compiler.scala
+++ b/test/files/run/existentials-in-compiler.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warnings; re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with
*/
import scala.tools.nsc._
import scala.tools.partest.CompilerTest
diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala
index 4ab2fac8dd..156121cab5 100644
--- a/test/files/run/is-valid-num.scala
+++ b/test/files/run/is-valid-num.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warnings; re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with
*/
object Test {
def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
diff --git a/test/files/run/iterator-from.scala b/test/files/run/iterator-from.scala
index e2ca5864ea..e7ba1aeb28 100644
--- a/test/files/run/iterator-from.scala
+++ b/test/files/run/iterator-from.scala
@@ -1,5 +1,5 @@
/* This file tests iteratorFrom, keysIteratorFrom, and valueIteratorFrom on various sorted sets and maps
- * filter: inliner warnings; re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with
*/
import scala.util.{Random => R}
diff --git a/test/files/run/mapConserve.scala b/test/files/run/mapConserve.scala
index f52af3b9f4..c17754283a 100644
--- a/test/files/run/mapConserve.scala
+++ b/test/files/run/mapConserve.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warnings; re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with
*/
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala
index 5fecac9d94..d4ae305aa7 100644
--- a/test/files/run/pc-conversions.scala
+++ b/test/files/run/pc-conversions.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning; re-run with -Yinline-warnings for details
+ * filter: inliner warning; re-run with
*/
import collection._
diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala
index e18375d521..ae7c0e5d7a 100644
--- a/test/files/run/stringinterpolation_macro-run.scala
+++ b/test/files/run/stringinterpolation_macro-run.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warnings; re-run with -Yinline-warnings for details
+ * filter: inliner warnings; re-run with
*/
object Test extends App {
diff --git a/test/files/run/synchronized.check b/test/files/run/synchronized.check
index eab191b4ed..9add05ea0c 100644
--- a/test/files/run/synchronized.check
+++ b/test/files/run/synchronized.check
@@ -1,4 +1,8 @@
+#partest !-Ybackend:GenBCode
warning: there were 14 inliner warnings; re-run with -Yinline-warnings for details
+#partest -Ybackend:GenBCode
+warning: there were 14 inliner warnings; re-run with -Yopt-warnings for details
+#partest
.|. c1.f1: OK
.|. c1.fi: OK
.|... c1.fv: OK
diff --git a/test/files/run/t7096.scala b/test/files/run/t7096.scala
index 872562dd4d..f723d70abe 100644
--- a/test/files/run/t7096.scala
+++ b/test/files/run/t7096.scala
@@ -1,5 +1,5 @@
/*
- * filter: inliner warning; re-run with -Yinline-warnings for details
+ * filter: inliner warning; re-run with
*/
import scala.tools.partest._
import scala.tools.nsc._
diff --git a/test/files/run/t7582.check b/test/files/run/t7582.check
index cd951d8d4f..2a11210000 100644
--- a/test/files/run/t7582.check
+++ b/test/files/run/t7582.check
@@ -1,2 +1,6 @@
+#partest !-Ybackend:GenBCode
warning: there was one inliner warning; re-run with -Yinline-warnings for details
+#partest -Ybackend:GenBCode
+warning: there was one inliner warning; re-run with -Yopt-warnings for details
+#partest
2
diff --git a/test/files/run/t7582b.check b/test/files/run/t7582b.check
index cd951d8d4f..2a11210000 100644
--- a/test/files/run/t7582b.check
+++ b/test/files/run/t7582b.check
@@ -1,2 +1,6 @@
+#partest !-Ybackend:GenBCode
warning: there was one inliner warning; re-run with -Yinline-warnings for details
+#partest -Ybackend:GenBCode
+warning: there was one inliner warning; re-run with -Yopt-warnings for details
+#partest
2
diff --git a/test/files/run/t7974.check b/test/files/run/t7974.check
index d8152d3286..4eae5eb152 100644
--- a/test/files/run/t7974.check
+++ b/test/files/run/t7974.check
@@ -1,19 +1,3 @@
-public class Symbols {
-
-
-
-
- // access flags 0x12
- private final Lscala/Symbol; someSymbol3
-
- // access flags 0xA
- private static Lscala/Symbol; symbol$1
-
- // access flags 0xA
- private static Lscala/Symbol; symbol$2
-
- // access flags 0xA
- private static Lscala/Symbol; symbol$3
// access flags 0x9
public static <clinit>()V
@@ -33,6 +17,7 @@ public class Symbols {
MAXSTACK = 2
MAXLOCALS = 0
+
// access flags 0x1
public someSymbol1()Lscala/Symbol;
GETSTATIC Symbols.symbol$1 : Lscala/Symbol;
@@ -40,6 +25,7 @@ public class Symbols {
MAXSTACK = 1
MAXLOCALS = 1
+
// access flags 0x1
public someSymbol2()Lscala/Symbol;
GETSTATIC Symbols.symbol$2 : Lscala/Symbol;
@@ -47,6 +33,7 @@ public class Symbols {
MAXSTACK = 1
MAXLOCALS = 1
+
// access flags 0x1
public sameSymbol1()Lscala/Symbol;
GETSTATIC Symbols.symbol$1 : Lscala/Symbol;
@@ -54,6 +41,7 @@ public class Symbols {
MAXSTACK = 1
MAXLOCALS = 1
+
// access flags 0x1
public someSymbol3()Lscala/Symbol;
ALOAD 0
@@ -62,6 +50,7 @@ public class Symbols {
MAXSTACK = 1
MAXLOCALS = 1
+
// access flags 0x1
public <init>()V
ALOAD 0
@@ -72,4 +61,4 @@ public class Symbols {
RETURN
MAXSTACK = 2
MAXLOCALS = 1
-}
+
diff --git a/test/files/run/t7974/Test.scala b/test/files/run/t7974/Test.scala
index 29d2b9cb64..296ec32ee2 100644
--- a/test/files/run/t7974/Test.scala
+++ b/test/files/run/t7974/Test.scala
@@ -1,20 +1,14 @@
-import java.io.PrintWriter;
+import java.io.PrintWriter
import scala.tools.partest.BytecodeTest
+import scala.tools.nsc.backend.jvm.AsmUtils
import scala.tools.asm.util._
import scala.tools.nsc.util.stringFromWriter
+import scala.collection.convert.decorateAsScala._
object Test extends BytecodeTest {
def show {
val classNode = loadClassNode("Symbols", skipDebugInfo = true)
- val textifier = new Textifier
- classNode.accept(new TraceClassVisitor(null, textifier, null))
-
- val classString = stringFromWriter(w => textifier.print(w))
- val result =
- classString.split('\n')
- .dropWhile(elem => elem != "public class Symbols {")
- .filterNot(elem => elem.startsWith(" @Lscala/reflect/ScalaSignature") || elem.startsWith(" ATTRIBUTE ScalaSig"))
- result foreach println
+ classNode.methods.asScala.foreach(m => println(AsmUtils.textify(m)))
}
}
diff --git a/test/files/run/t9219.check b/test/files/run/t9219.check
new file mode 100644
index 0000000000..3509ece003
--- /dev/null
+++ b/test/files/run/t9219.check
@@ -0,0 +1,3 @@
+Stream(1, 2, ?)
+Stream(1, 2, 3, 4, ?)
+Stream(1, 2, 3, 4, 5, 6, ?)
diff --git a/test/files/run/t9219.scala b/test/files/run/t9219.scala
new file mode 100644
index 0000000000..c15f55faac
--- /dev/null
+++ b/test/files/run/t9219.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ def check[U](f: Stream[Int] => U) = {
+ val s = Stream.from(1)
+ f(s)
+ println(s)
+ }
+
+ check(_.tail)
+ check(_.take(4).force)
+ check(_(5))
+}
diff --git a/test/files/run/t9223.scala b/test/files/run/t9223.scala
new file mode 100644
index 0000000000..78767b158d
--- /dev/null
+++ b/test/files/run/t9223.scala
@@ -0,0 +1,8 @@
+class X(val x: String)
+class Y(y: => String) extends X(y) { def f = y }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ assert(new Y("hi").f == "hi")
+ }
+}
diff --git a/test/files/run/t9223b.scala b/test/files/run/t9223b.scala
new file mode 100644
index 0000000000..2afc7ddfe0
--- /dev/null
+++ b/test/files/run/t9223b.scala
@@ -0,0 +1,8 @@
+class X(x: => String) { def xx = x }
+class Y(y: String) extends X(y) { def f = y }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ assert(new Y("hi").f == "hi")
+ }
+}