From 596b85373b0203e7557f71e1bced980e277ec751 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Wed, 3 Jul 2013 02:06:25 -0700 Subject: SI-4594 Repl settings command A settings command for the rest of us. The usual command line options are used, except that boolean flags are enabled with +flag and disabled with -flag. ``` scala> :settings +deprecation scala> new BigInt(java.math.BigInteger.TEN) { } :8: warning: inheritance from class BigInt in package math is deprecated: This class will me made final. new BigInt(java.math.BigInteger.TEN) { } ^ res0: BigInt = 10 scala> :settings -deprecation scala> new BigInt(java.math.BigInteger.TEN) { } res1: BigInt = 10 ``` Multivalue "colon" options can be reset by supplying no values after the colon. This behavior is different from the command line. ``` scala> 1 toString warning: there were 1 feature warning(s); re-run with -feature for details res0: String = 1 scala> :settings -language:postfixOps scala> 1 toString res1: String = 1 scala> :settings -d = . -encoding = UTF-8 -explaintypes = false -language = List(postfixOps) -nowarn = false scala> :settings -language: scala> :settings -d = . -encoding = UTF-8 -explaintypes = false -language = List() -nowarn = false ``` --- test/files/run/t4594-repl-settings.scala | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/files/run/t4594-repl-settings.scala (limited to 'test') diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala new file mode 100644 index 0000000000..d2335460e5 --- /dev/null +++ b/test/files/run/t4594-repl-settings.scala @@ -0,0 +1,26 @@ + +import scala.tools.partest.SessionTest + +// Detected repl transcript paste: ctrl-D to finish. +object Test extends SessionTest { + def session = +""" |Type in expressions to have them evaluated. + |Type :help for more information. + | + |scala> @deprecated(message="Please don't do that.", since="Time began.") def depp = "john" + |depp: String + | + |scala> def a = depp + |warning: there were 1 deprecation warning(s); re-run with -deprecation for details + |a: String + | + |scala> :settings +deprecation + | + |scala> def b = depp + |:8: warning: method depp is deprecated: Please don't do that. + | def b = depp + | ^ + |b: String + | + |scala> """ +} -- cgit v1.2.3