From 816a444f177b5f2bb90a2e89802d06c26f6a21ff Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Mon, 1 Jul 2013 00:30:16 -0700 Subject: SI-4684 Repl supports whole-file paste Add a file argument to the :paste command which loads the file's contents as though entered in :paste mode. The :paste command is replayable. Samples, including companions defined together: ``` scala> :paste junk.scala File contains no code: junk.scala scala> :paste no-file.scala That file does not exist scala> :paste obj-repl.scala Pasting file obj-repl.scala... :2: error: expected start of definition private foo = 7 ^ scala> :paste hw-repl.scala Pasting file hw-repl.scala... The pasted code is incomplete! :5: error: illegal start of simple expression } ^ scala> :replay Replaying: :paste junk.scala File contains no code: junk.scala Replaying: :paste obj-repl.scala Pasting file obj-repl.scala... defined trait Foo defined object Foo Replaying: Foo(new Foo{}) res0: Int = 7 ``` --- test/files/run/repl-paste-4.pastie | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test/files/run/repl-paste-4.pastie (limited to 'test/files/run/repl-paste-4.pastie') diff --git a/test/files/run/repl-paste-4.pastie b/test/files/run/repl-paste-4.pastie new file mode 100644 index 0000000000..853a66f6a4 --- /dev/null +++ b/test/files/run/repl-paste-4.pastie @@ -0,0 +1,4 @@ + +// if we are truly companions, I can see your foo +class Foo { private val foo = 7 } +object Foo { def apply(f: Foo) = f.foo } -- cgit v1.2.3