diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-09-15 23:32:09 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-09-22 00:00:15 -0700 |
commit | e720babdaf999878642c18cebec4c18e93988d54 (patch) | |
tree | 050e8c543d2326bd129704450bbff0aba885682d /test/files/run/t4594-repl-settings.scala | |
parent | 252901054e40276abdb734673e41c6ce01adb7cc (diff) | |
download | scala-e720babdaf999878642c18cebec4c18e93988d54.tar.gz scala-e720babdaf999878642c18cebec4c18e93988d54.tar.bz2 scala-e720babdaf999878642c18cebec4c18e93988d54.zip |
SI-6502 Repl reset/replay take settings args
The reset and replay commands take arbitrary command line args.
When settings args are supplied, the compiler is recreated.
For uniformity, the settings command performs only the usual
arg parsing: use -flag:true instead of +flag, and clearing a
setting is promoted to the command line, so that -Xlint: is not
an error but clears the flags.
```
scala> maqicode.Test main null
<console>:8: error: not found: value maqicode
maqicode.Test main null
^
scala> :reset -classpath/a target/scala-2.11/sample_2.11-1.0.jar
Resetting interpreter state.
Forgetting all expression results and named terms: $intp
scala> maqicode.Test main null
Hello, world.
scala> val i = 42
i: Int = 42
scala> s"$i is the loneliest numbah."
res1: String = 42 is the loneliest numbah.
scala> :replay -classpath ""
Replaying: maqicode.Test main null
Hello, world.
Replaying: val i = 42
i: Int = 42
Replaying: s"$i is the loneliest numbah."
res1: String = 42 is the loneliest numbah.
scala> :replay -classpath/a ""
Replaying: maqicode.Test main null
<console>:8: error: not found: value maqicode
maqicode.Test main null
^
Replaying: val i = 42
i: Int = 42
Replaying: s"$i is the loneliest numbah."
res1: String = 42 is the loneliest numbah.
```
Clearing a clearable setting:
```
scala> :reset -Xlint:missing-interpolator
Resetting interpreter state.
scala> { val i = 42 ; "$i is the loneliest numbah." }
<console>:8: warning: possible missing interpolator: detected interpolated identifier `$i`
{ val i = 42 ; "$i is the loneliest numbah." }
^
res0: String = $i is the loneliest numbah.
scala> :reset -Xlint:
Resetting interpreter state.
Forgetting this session history:
{ val i = 42 ; "$i is the loneliest numbah." }
scala> { val i = 42 ; "$i is the loneliest numbah." }
res0: String = $i is the loneliest numbah.
```
Diffstat (limited to 'test/files/run/t4594-repl-settings.scala')
-rw-r--r-- | test/files/run/t4594-repl-settings.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala index 4202991607..db5dc19866 100644 --- a/test/files/run/t4594-repl-settings.scala +++ b/test/files/run/t4594-repl-settings.scala @@ -14,7 +14,7 @@ object Test extends SessionTest { |warning: there was one deprecation warning; re-run with -deprecation for details |a: String | - |scala> :settings +deprecation + |scala> :settings -deprecation | |scala> def b = depp |<console>:8: warning: method depp is deprecated: Please don't do that. |