From 7d94d553e960322472e274669bad1c47723c2d23 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Fri, 8 Jul 2016 13:32:36 -0700 Subject: 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 :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 ^ :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 ``` --- src/repl/scala/tools/nsc/MainGenericRunner.scala | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/repl') 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) } -- cgit v1.2.3