diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-07-08 13:32:36 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-07-08 13:32:36 -0700 |
commit | 7d94d553e960322472e274669bad1c47723c2d23 (patch) | |
tree | 2604ce9027081bcfca296dfd8ebbc47f1fe9bef9 /src/repl | |
parent | 4e564efb04e508ccc0f479cf1a25331501927d88 (diff) | |
download | scala-7d94d553e960322472e274669bad1c47723c2d23.tar.gz scala-7d94d553e960322472e274669bad1c47723c2d23.tar.bz2 scala-7d94d553e960322472e274669bad1c47723c2d23.zip |
SI-8829 Defaultly scala -feature -deprecation
Turn on `-feature -deprecation` in REPL if neither option
is selected.
```
$ ./build/pack/bin/scala
Welcome to Scala 2.12.0-20160707-105953-4e564ef (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.
scala> @deprecated("","") def f = 42
f: Int
scala> f toDouble
<console>:13: warning: postfix operator toDouble should be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the import clause 'import scala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scaladoc for value scala.language.postfixOps for a discussion
why the feature should be explicitly enabled.
f toDouble
^
<console>:13: warning: method f is deprecated:
f toDouble
^
res1: Double = 42.0
scala> :quit
$ scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.
scala> @deprecated("","") def f = 42
f: Int
scala> f toDouble
warning: there was one deprecation warning; re-run with -deprecation for details
warning: there was one feature warning; re-run with -feature for details
res1: Double = 42.0
```
Diffstat (limited to 'src/repl')
-rw-r--r-- | src/repl/scala/tools/nsc/MainGenericRunner.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/repl/scala/tools/nsc/MainGenericRunner.scala b/src/repl/scala/tools/nsc/MainGenericRunner.scala index 747b684293..a09e797e07 100644 --- a/src/repl/scala/tools/nsc/MainGenericRunner.scala +++ b/src/repl/scala/tools/nsc/MainGenericRunner.scala @@ -71,6 +71,11 @@ class MainGenericRunner { Right(false) case _ => // We start the repl when no arguments are given. + // If user is agnostic about both -feature and -deprecation, turn them on. + if (settings.deprecation.isDefault && settings.feature.isDefault) { + settings.deprecation.value = true + settings.feature.value = true + } Right(new interpreter.ILoop process settings) } |