You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When feature warnings and deprecation ones are both present, :warnings only shows deprecation warnings. As an aside, the messages for deprecation/feature warnings, both in the compiler and in the REPL, suggest rerunning with extra options, while in the REPL they should suggest using the :warnings command.
Let's compare the warnings that :warnings shows us for the following two lines of code:
The first will give deprecation and feature warnings, the second only feature warnings.
$ ./qbin/scala
Welcome to Scala version 2.10.0-20120828-070538-8ca87e36ba (OpenJDK64-BitServerVM, Java1.6.0_24).
Type in expressions to have them evaluated.
Type:help for more information.
scala>implicitdefany2optionable(x : AnyRef) =new {defmatchInstance[B:Manifest]:Option[B] =null}
warning: there were 2 deprecation warnings; re-run with-deprecation for details
warning: there were 1 feature warnings; re-run with-feature for details
any2optionable: (x: AnyRef)Object{defmatchInstance[B](implicitevidence$1: Manifest[B]):Option[B]}
scala>:warnings
<console>:7:warning: typeManifest in objectPredef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
implicitdefany2optionable(x : AnyRef) =new {defmatchInstance[B:Manifest]:Option[B] =null}
^
<console>:7:warning: typeManifest in objectPredef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
implicitdefany2optionable(x : AnyRef) =new {defmatchInstance[B:Manifest]:Option[B] =null}
^
scala>implicitdefany2optionable(x : AnyRef) =new {defmatchInstance[B]:Option[B] =null}
warning: there were 1 feature warnings; re-run with-feature for details
any2optionable: (x: AnyRef)Object{defmatchInstance[B]:Option[B]}
scala>:warnings
<console>:8:warning: implicit conversion method any2optionable should be enabled
by making the implicit value language.implicitConversions visible.
This can be achieved by adding the importclause 'importlanguage.implicitConversions'
or by setting the compiler option -language:implicitConversions.
See the Scala docs for value scala.language.implicitConversions for a discussion
why the feature should be explicitly enabled.
implicitdefany2optionable(x : AnyRef) =new {defmatchInstance[B]:Option[B] =null}
^
Finally, the count of feature warnings seems wrong (two counted, one shown):
scala>implicitdefany2optionable(x : AnyRef) =new {defmatchInstance[B]:Option[B] =null}
warning: there were 1 feature warnings; re-run with-feature for details
any2optionable: (x: AnyRef)Object{defmatchInstance[B]:Option[B]}
scala>"".matchInstance
warning: there were 2 feature warnings; re-run with-feature for details
res0:Option[Nothing] =null
scala>:warnings
<console>:9:warning: reflective access of structural typemember method matchInstance should be enabled
by making the implicit value language.reflectiveCalls visible.
This can be achieved by adding the importclause 'importlanguage.reflectiveCalls'
or by setting the compiler option -language:reflectiveCalls.
See the Scala docs for value scala.language.reflectiveCalls for a discussion
why the feature should be explicitly enabled.
"".matchInstance
^
In the above example, also when using -feature one still gets a single feature warning.
The text was updated successfully, but these errors were encountered:
@som-snytt said:
That was #6120. Now it needs a dash of configurable reporter.
scala>objectX { @deprecated("","") defx():Int=42 }
defined objectX
scala>X x
warning: there was one deprecation warning; re-run with-deprecation for details
warning: there was one feature warning; re-run with-feature for details
res0:Int=42
scala>:warnings
<console>:9:warning: method x in objectX is deprecated:
X x
^
<console>:9:warning: postfix operator x should be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the importclause 'importscala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scala docs for value scala.language.postfixOps for a discussion
why the feature should be explicitly enabled.
X x
^
scala>:replay -deprecation
Replaying:objectX { @deprecated("","") defx():Int=42 }
defined objectXReplaying:X x
<console>:9:warning: method x in objectX is deprecated:
X x
^
warning: there was one feature warning; re-run with-feature for details
res0:Int=42
When feature warnings and deprecation ones are both present,
:warnings
only shows deprecation warnings. As an aside, the messages for deprecation/feature warnings, both in the compiler and in the REPL, suggest rerunning with extra options, while in the REPL they should suggest using the:warnings
command.Let's compare the warnings that
:warnings
shows us for the following two lines of code:The first will give deprecation and feature warnings, the second only feature warnings.
Finally, the count of feature warnings seems wrong (two counted, one shown):
In the above example, also when using -feature one still gets a single feature warning.
The text was updated successfully, but these errors were encountered: