summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/IMain.scala2
-rw-r--r--test/files/run/repl-paste-3.check14
-rw-r--r--test/files/run/repl-paste-3.scala8
-rw-r--r--test/files/run/repl-paste.check22
-rw-r--r--test/files/run/repl-paste.scala20
5 files changed, 44 insertions, 22 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
index 47e1aa49bb..467805fe36 100644
--- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
@@ -470,7 +470,7 @@ class IMain(val settings: Settings, protected val out: JPrintWriter) extends Imp
// Oh boy, the parser throws away parens so "(2+2)" is mispositioned.
// So until we can fix the parser we'll have to go trawling.
val adjustment = ((content take lastpos0).reverse takeWhile { ch =>
- ch.isWhitespace || ch == '(' || ch == ')'
+ ch.isWhitespace || ch == '('
}).length
val lastpos = lastpos0 - adjustment
diff --git a/test/files/run/repl-paste-3.check b/test/files/run/repl-paste-3.check
new file mode 100644
index 0000000000..2b4c941c33
--- /dev/null
+++ b/test/files/run/repl-paste-3.check
@@ -0,0 +1,14 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> println(3)
+3
+
+scala> List(1,2)
+res1: List[Int] = List(1, 2)
+
+scala>
+
+scala>
diff --git a/test/files/run/repl-paste-3.scala b/test/files/run/repl-paste-3.scala
new file mode 100644
index 0000000000..3f26799ccb
--- /dev/null
+++ b/test/files/run/repl-paste-3.scala
@@ -0,0 +1,8 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+println(3)
+ List(1,2)
+ """
+} \ No newline at end of file
diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check
index 50589433cd..d3e171fbfb 100644
--- a/test/files/run/repl-paste.check
+++ b/test/files/run/repl-paste.check
@@ -5,17 +5,17 @@ scala> :paste
// Entering paste mode (ctrl-D to finish)
- class Dingus
- {
- private val x = 5
- def y = Dingus.x * 2
- }
- object Dingus
- {
- private val x = 55
- }
-
- val x = (new Dingus).y
+class Dingus
+{
+ private val x = 5
+ def y = Dingus.x * 2
+}
+object Dingus
+{
+ private val x = 55
+}
+
+val x = (new Dingus).y
// Exiting paste mode, now interpreting.
diff --git a/test/files/run/repl-paste.scala b/test/files/run/repl-paste.scala
index e2ebab1e45..5495505353 100644
--- a/test/files/run/repl-paste.scala
+++ b/test/files/run/repl-paste.scala
@@ -3,17 +3,17 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = ":paste\n" + (
"""
- class Dingus
- {
- private val x = 5
- def y = Dingus.x * 2
- }
- object Dingus
- {
- private val x = 55
- }
+class Dingus
+{
+ private val x = 5
+ def y = Dingus.x * 2
+}
+object Dingus
+{
+ private val x = 55
+}
- val x = (new Dingus).y
+val x = (new Dingus).y
"""
)
} \ No newline at end of file