summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-11-29 10:40:53 +1000
committerGitHub <noreply@github.com>2016-11-29 10:40:53 +1000
commit2bc92e0b2fa9f6de2b2a6c8f9ef4b85492e7df4d (patch)
tree929108e6ac5c31964be3dd13bdbf197a0281e146 /test/files
parent57d98fda843d3b23757b48e0c6eebb7bd8eedc5d (diff)
parent1b2cd1be9790bf9c14fd68c78f784d6cb4f7c907 (diff)
downloadscala-2bc92e0b2fa9f6de2b2a6c8f9ef4b85492e7df4d.tar.gz
scala-2bc92e0b2fa9f6de2b2a6c8f9ef4b85492e7df4d.tar.bz2
scala-2bc92e0b2fa9f6de2b2a6c8f9ef4b85492e7df4d.zip
Merge pull request #5544 from retronym/ticket/8779
SI-8779 Enable inlining of code within a REPL session
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/repl-inline.check11
-rw-r--r--test/files/run/repl-inline.scala27
-rw-r--r--test/files/run/t7747-repl.check6
3 files changed, 41 insertions, 3 deletions
diff --git a/test/files/run/repl-inline.check b/test/files/run/repl-inline.check
new file mode 100644
index 0000000000..db729a67dd
--- /dev/null
+++ b/test/files/run/repl-inline.check
@@ -0,0 +1,11 @@
+warning: there was one deprecation warning (since 2.11.0); re-run with -deprecation for details
+callerOfCaller: String
+g: String
+h: String
+g: String
+h: String
+callerOfCaller: String
+g: String
+h: String
+g: String
+h: String
diff --git a/test/files/run/repl-inline.scala b/test/files/run/repl-inline.scala
new file mode 100644
index 0000000000..260ed28a4f
--- /dev/null
+++ b/test/files/run/repl-inline.scala
@@ -0,0 +1,27 @@
+import scala.tools.nsc._
+
+object Test {
+ val testCode =
+ """
+def callerOfCaller = Thread.currentThread.getStackTrace.drop(2).head.getMethodName
+def g = callerOfCaller
+def h = g
+assert(h == "g", h)
+@inline def g = callerOfCaller
+def h = g
+assert(h == "h", h)
+ """
+
+ def main(args: Array[String]) {
+ def test(f: Settings => Unit): Unit = {
+ val settings = new Settings()
+ settings.processArgumentString("-opt:l:classpath")
+ f(settings)
+ settings.usejavacp.value = true
+ val repl = new interpreter.IMain(settings)
+ testCode.linesIterator.foreach(repl.interpret(_))
+ }
+ test(_ => ())
+ test(_.Yreplclassbased.value = true)
+ }
+}
diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check
index 621a70205e..ab37da5722 100644
--- a/test/files/run/t7747-repl.check
+++ b/test/files/run/t7747-repl.check
@@ -246,12 +246,12 @@ scala> case class Bingo()
defined class Bingo
scala> List(BippyBups(), PuppyPups(), Bingo()) // show
-class $read extends _root_.java.io.Serializable {
+sealed class $read extends _root_.java.io.Serializable {
def <init>() = {
super.<init>;
()
};
- class $iw extends _root_.java.io.Serializable {
+ sealed class $iw extends _root_.java.io.Serializable {
def <init>() = {
super.<init>;
()
@@ -262,7 +262,7 @@ class $read extends _root_.java.io.Serializable {
import $line45.$read.INSTANCE.$iw.$iw.PuppyPups;
import $line46.$read.INSTANCE.$iw.$iw.Bingo;
import $line46.$read.INSTANCE.$iw.$iw.Bingo;
- class $iw extends _root_.java.io.Serializable {
+ sealed class $iw extends _root_.java.io.Serializable {
def <init>() = {
super.<init>;
()