Warning summary respects -nowarn
Previously, hasWarning meant a warning had been displayed
(as opposed to counted). Since last refactor, it means
counted, so warnings were summarized under -nowarn.
Until 2.13.1, there was no summary under -nowarn.
Let -nowarn mean -Xmaxwarns 0 (to mean show me no warnings)
and additionally don't summarize any warnings (including
erroring under -Werror).
Named constants for Reporter.filter
Test that suppression is relaxed in debug mode.
Restore maxwarns after suppressing
Scaladoc also touches nowarn
ConsoleReporter respects nowarn, since PerRunReporting
suppression mechanism has a checkpoint after typer,
such that subsequent warnings are issued directly and
therefore bump the warnings count.
(cherry picked from commit 2a2f4169ca
)
This commit is contained in:
parent
b60e48d852
commit
1afdb3cb6c
|
@ -266,7 +266,8 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w
|
|||
/** Has any macro expansion used a fallback during this run? */
|
||||
var seenMacroExpansionsFallingBack = false
|
||||
|
||||
def summarizeErrors(): Unit = if (!reporter.hasErrors) {
|
||||
// i.e., summarize warnings
|
||||
def summarizeErrors(): Unit = if (!reporter.hasErrors && !settings.nowarn) {
|
||||
for (c <- summarizedWarnings.keys.toList.sortBy(_.name))
|
||||
summarize(Action.WarningSummary, c)
|
||||
for (c <- summarizedInfos.keys.toList.sortBy(_.name))
|
||||
|
|
|
@ -26,8 +26,10 @@ class ConsoleReporter(val settings: Settings, val reader: BufferedReader, val wr
|
|||
|
||||
override def finish(): Unit = {
|
||||
import reflect.internal.util.StringOps.{countElementsAsString => countAs}
|
||||
if (hasWarnings) echo(s"${countAs(warningCount, WARNING.toString.toLowerCase)} found")
|
||||
if (hasErrors) echo(s"${countAs(errorCount, ERROR.toString.toLowerCase)} found")
|
||||
if (!settings.nowarn && hasWarnings)
|
||||
echo(s"${countAs(warningCount, WARNING.toString.toLowerCase)} found")
|
||||
if (hasErrors)
|
||||
echo(s"${countAs(errorCount, ERROR.toString.toLowerCase)} found")
|
||||
super.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,19 +97,20 @@ abstract class FilteringReporter extends Reporter {
|
|||
private def maxErrors: Int = settings.maxerrs.value
|
||||
private def maxWarnings: Int = settings.maxwarns.value
|
||||
|
||||
private def noWarnings: Boolean = settings.nowarn.value
|
||||
|
||||
override def filter(pos: Position, msg: String, severity: Severity): Int = {
|
||||
import internal.Reporter.{ERROR => Error, WARNING => Warning, _}
|
||||
def maxOk = severity match {
|
||||
case internal.Reporter.ERROR => maxErrors < 0 || errorCount < maxErrors
|
||||
case internal.Reporter.WARNING => !noWarnings && (maxWarnings < 0 || warningCount < maxWarnings)
|
||||
case _ => true
|
||||
case Error => maxErrors < 0 || errorCount < maxErrors
|
||||
case Warning => maxWarnings < 0 || warningCount < maxWarnings
|
||||
case _ => true
|
||||
}
|
||||
if (!duplicateOk(pos, severity, msg)) {
|
||||
notifySuppressed(pos, msg, severity)
|
||||
2 // don't count, don't display
|
||||
} else if (!maxOk) 1 // count, but don't display
|
||||
else 0
|
||||
// Invoked when an error or warning is filtered by position.
|
||||
@inline def suppress = {
|
||||
if (settings.prompt) doReport(pos, msg, severity)
|
||||
else if (settings.debug) doReport(pos, s"[ suppressed ] $msg", severity)
|
||||
Suppress
|
||||
}
|
||||
if (!duplicateOk(pos, severity, msg)) suppress else if (!maxOk) Count else Display
|
||||
}
|
||||
|
||||
/** Returns `true` if the message should be reported. Messages are skipped if:
|
||||
|
@ -139,12 +140,6 @@ abstract class FilteringReporter extends Reporter {
|
|||
}
|
||||
}
|
||||
|
||||
/* Invoked when an error or warning is filtered by position. */
|
||||
private def notifySuppressed(pos: Position, msg: String, severity: Severity): Unit = {
|
||||
if (settings.prompt) doReport(pos, msg, severity)
|
||||
else if (settings.debug) doReport(pos, "[ suppressed ] " + msg, severity)
|
||||
}
|
||||
|
||||
override def reset(): Unit = {
|
||||
super.reset()
|
||||
positions.clear()
|
||||
|
|
|
@ -51,7 +51,7 @@ trait StandardScalaSettings { _: MutableSettings =>
|
|||
}
|
||||
val g = ChoiceSetting ("-g", "level", "Set level of generated debugging info.", List("none", "source", "line", "vars", "notailcalls"), "vars")
|
||||
val help = BooleanSetting ("-help", "Print a synopsis of standard options")
|
||||
val nowarn = BooleanSetting ("-nowarn", "Generate no warnings.")
|
||||
val nowarn = BooleanSetting ("-nowarn", "Generate no warnings.") withPostSetHook { s => if (s) maxwarns.value = 0 }
|
||||
val optimise: BooleanSetting // depends on post hook which mutates other settings
|
||||
val print = BooleanSetting ("-print", "Print program with Scala-specific features removed.")
|
||||
val target = ChoiceSettingForcedDefault ("-target", "target", "Target platform for object files. All JVM 1.5 - 1.7 targets are deprecated.",
|
||||
|
|
|
@ -101,12 +101,9 @@ abstract class Reporter {
|
|||
// If `force`, INFO messages were always printed. Now, INFO messages are always printed.
|
||||
protected def info0(pos: Position, msg: String, severity: Severity, force: Boolean): Unit
|
||||
|
||||
/** Return
|
||||
* - 0: count and display
|
||||
* - 1: count only, don't display
|
||||
* - 2: don't count, don't display
|
||||
*/
|
||||
def filter(pos: Position, msg: String, severity: Severity): Int = 0
|
||||
/** @return Reporter.Display, or override for Count, Suppress
|
||||
*/
|
||||
def filter(pos: Position, msg: String, severity: Severity): Int = Reporter.Display
|
||||
|
||||
final def echo(msg: String): Unit = echo(util.NoPosition, msg)
|
||||
final def echo(pos: Position, msg: String): Unit = if (filter(pos, msg, INFO) == 0) info0(pos, msg, INFO, force = true)
|
||||
|
@ -152,7 +149,11 @@ abstract class Reporter {
|
|||
}
|
||||
|
||||
object Reporter {
|
||||
sealed class Severity(val id: Int, override val toString: String)
|
||||
final val Display = 0 // display and count toward hasWarnings
|
||||
final val Count = 1 // no display but count toward hasWarnings
|
||||
final val Suppress = 2 // no display, does not bump count for hasWarnings
|
||||
|
||||
sealed abstract class Severity(val id: Int, override val toString: String)
|
||||
object INFO extends Severity(0, "INFO")
|
||||
object WARNING extends Severity(1, "WARNING")
|
||||
object ERROR extends Severity(2, "ERROR")
|
||||
|
|
|
@ -1275,6 +1275,7 @@ object IMain {
|
|||
private[interpreter] def withSuppressedSettings[A](settings: Settings, global: => Global)(body: => A): A = {
|
||||
import settings._
|
||||
val wasWarning = !nowarn
|
||||
val oldMaxWarn = maxwarns.value
|
||||
val noisy = List(Xprint, Ytyperdebug, browse)
|
||||
val current = (Xprint.value, Ytyperdebug.value, browse.value)
|
||||
val noisesome = wasWarning || noisy.exists(!_.isDefault)
|
||||
|
@ -1289,7 +1290,10 @@ object IMain {
|
|||
Xprint.value = current._1
|
||||
Ytyperdebug.value = current._2
|
||||
browse.value = current._3
|
||||
if (wasWarning) nowarn.value = false
|
||||
if (wasWarning) {
|
||||
nowarn.value = false
|
||||
maxwarns.value = oldMaxWarn
|
||||
}
|
||||
// ctl-D in repl can result in no compiler
|
||||
val g = global
|
||||
if (g != null) {
|
||||
|
|
|
@ -135,9 +135,16 @@ abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends Syntax
|
|||
import global.{ settings, Symbol }
|
||||
def parseComment(comment: DocComment) = {
|
||||
val nowarnings = settings.nowarn.value
|
||||
settings.nowarn.value = true
|
||||
val maxwarns = settings.maxwarns.value
|
||||
if (!nowarnings) {
|
||||
settings.nowarn.value = true
|
||||
}
|
||||
try parseAtSymbol(comment.raw, comment.raw, comment.pos)
|
||||
finally settings.nowarn.value = nowarnings
|
||||
finally
|
||||
if (!nowarnings) {
|
||||
settings.nowarn.value = false
|
||||
settings.maxwarns.value = maxwarns
|
||||
}
|
||||
}
|
||||
|
||||
override def internalLink(sym: Symbol, site: Symbol): Option[LinkTo] = None
|
||||
|
|
|
@ -93,7 +93,6 @@ scala> case class Bar(n: Int)
|
|||
defined class Bar
|
||||
|
||||
scala> implicit def foo2bar(foo: Foo) = Bar(foo.n)
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
foo2bar: (foo: Foo)Bar
|
||||
|
||||
scala> val bar: Bar = Foo(3)
|
||||
|
@ -267,7 +266,6 @@ scala> xs map (x => x)
|
|||
res6: Array[_] = Array(1, 2)
|
||||
|
||||
scala> xs map (x => (x, x))
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2))
|
||||
|
||||
scala>
|
||||
|
@ -353,10 +351,6 @@ defined class Term
|
|||
scala> def f(e: Exp) = e match { // non-exhaustive warning here
|
||||
case _:Fact => 3
|
||||
}
|
||||
<console>:18: warning: match may not be exhaustive.
|
||||
It would fail on the following inputs: Exp(), Term()
|
||||
def f(e: Exp) = e match { // non-exhaustive warning here
|
||||
^
|
||||
f: (e: Exp)Int
|
||||
|
||||
scala> :quit
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
error: No warnings can be incurred under -Xfatal-warnings.
|
||||
two warnings found
|
||||
one error found
|
|
@ -0,0 +1,10 @@
|
|||
// scalac: -Xfatal-warnings -Xlint -Xmaxwarns 0
|
||||
//
|
||||
// nowarn should mean no warnings are emitted,
|
||||
// irrespective of other flags, and also no
|
||||
// warnings should be summarized.
|
||||
//
|
||||
class C {
|
||||
def f = 1 → 2
|
||||
def g: Unit = 1
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
[running phase parser on t11952b.scala]
|
||||
[running phase namer on t11952b.scala]
|
||||
[running phase packageobjects on t11952b.scala]
|
||||
[running phase typer on t11952b.scala]
|
||||
[running phase patmat on t11952b.scala]
|
||||
[running phase superaccessors on t11952b.scala]
|
||||
[running phase extmethods on t11952b.scala]
|
||||
[running phase pickler on t11952b.scala]
|
||||
[running phase refchecks on t11952b.scala]
|
||||
t11952b.scala:9: error: overriding method f in class C of type => String;
|
||||
method f cannot override final member;
|
||||
found : => scala.this.Int
|
||||
required: => String
|
||||
override def f: Int = 42
|
||||
^
|
||||
one error found
|
|
@ -0,0 +1,10 @@
|
|||
// scalac: -Xfatal-warnings -Xlint -Ydebug
|
||||
//
|
||||
// Multiple errors at a location are shown under debug.
|
||||
//
|
||||
class C {
|
||||
final def f: String = "hello, world"
|
||||
}
|
||||
class D extends C {
|
||||
override def f: Int = 42
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// scalac: -Xfatal-warnings -Xlint -nowarn
|
||||
//
|
||||
// nowarn should mean no warnings are emitted,
|
||||
// irrespective of other flags, and also no
|
||||
// warnings should be summarized.
|
||||
//
|
||||
class C {
|
||||
def f = 1 → 2
|
||||
def g: Unit = 1
|
||||
}
|
|
@ -69,11 +69,9 @@ scala> var four = "four"
|
|||
four: String = four
|
||||
|
||||
scala> val four2 = m(four) // should have an existential bound
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
four2: String @Annot(x) forSome { val x: String } = four
|
||||
|
||||
scala> val four3 = four2 // should have the same type as four2
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
four3: String @Annot(x) forSome { val x: String } = four
|
||||
|
||||
scala> val stuff = m("stuff") // should not crash
|
||||
|
@ -96,7 +94,6 @@ scala> def m = {
|
|||
val y : String @Annot(x) = x
|
||||
y
|
||||
} // x should not escape the local scope with a narrow type
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
m: String @Annot(x) forSome { val x: String }
|
||||
|
||||
scala>
|
||||
|
@ -110,7 +107,6 @@ scala> def n(y: String) = {
|
|||
}
|
||||
m("stuff".stripMargin)
|
||||
} // x should be existentially bound
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
n: (y: String)String @Annot(x) forSome { val x: String }
|
||||
|
||||
scala>
|
||||
|
|
|
@ -19,7 +19,6 @@ scala> def test(n: Int): Unit = {
|
|||
val x = sig.asInstanceOf[MethodType].params.head
|
||||
println(x.info)
|
||||
}
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
test: (n: Int)Unit
|
||||
|
||||
scala> for (i <- 1 to 8) test(i)
|
||||
|
|
|
@ -1,32 +1,14 @@
|
|||
|
||||
scala> 2 ; 3
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
2 ;;
|
||||
^
|
||||
res0: Int = 3
|
||||
|
||||
scala> { 2 ; 3 }
|
||||
<console>:12: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
|
||||
{ 2 ; 3 }
|
||||
^
|
||||
res1: Int = 3
|
||||
|
||||
scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
1 +
|
||||
2 +
|
||||
3 } ; bippy+88+11
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
defined object Cow
|
||||
defined class Moo
|
||||
bippy: Int
|
||||
|
|
|
@ -8,9 +8,6 @@ defined class Value
|
|||
defined object Value
|
||||
|
||||
scala> class C { final case class Num(value: Double) } // here it should still warn
|
||||
<console>:11: warning: The outer reference in this type test cannot be checked at run time.
|
||||
class C { final case class Num(value: Double) } // here it should still warn
|
||||
^
|
||||
defined class C
|
||||
|
||||
scala> :quit
|
||||
|
|
|
@ -7,11 +7,9 @@ Try :help or completions for vals._ and power._
|
|||
scala> // guarding against "error: reference to global is ambiguous"
|
||||
|
||||
scala> global.emptyValDef // "it is imported twice in the same scope by ..."
|
||||
warning: one deprecation (since 2.11.0); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
res0: $r.global.noSelfType.type = private val _ = _
|
||||
|
||||
scala> val tp = ArrayClass[scala.util.Random] // magic with tags
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
tp: $r.global.Type = Array[scala.util.Random]
|
||||
|
||||
scala> tp.memberType(Array_apply) // evidence
|
||||
|
|
|
@ -76,15 +76,9 @@ y: Int = 13
|
|||
scala>
|
||||
|
||||
scala> 2 ; 3
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
2 ;;
|
||||
^
|
||||
res14: Int = 3
|
||||
|
||||
scala> { 2 ; 3 }
|
||||
<console>:12: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
|
||||
{ 2 ; 3 }
|
||||
^
|
||||
res15: Int = 3
|
||||
|
||||
scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def
|
||||
|
@ -92,18 +86,6 @@ bippy = {
|
|||
1 +
|
||||
2 +
|
||||
3 } ; bippy+88+11
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def
|
||||
^
|
||||
defined object Cow
|
||||
defined class Moo
|
||||
bippy: Int
|
||||
|
@ -143,12 +125,6 @@ scala> ( (2 + 2 ) )
|
|||
res24: Int = 4
|
||||
|
||||
scala> 5 ; ( (2 + 2 ) ) ; ((5))
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; ( (2 + 2 ) ) ;;
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; ( (2 + 2 ) ) ;;
|
||||
^
|
||||
res25: Int = 5
|
||||
|
||||
scala> (((2 + 2)), ((2 + 2)))
|
||||
|
@ -163,18 +139,9 @@ res28: String = 4423
|
|||
scala>
|
||||
|
||||
scala> 55 ; ((2 + 2)) ; (1, 2, 3)
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; ((2 + 2)) ;;
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; ((2 + 2)) ;;
|
||||
^
|
||||
res29: (Int, Int, Int) = (1,2,3)
|
||||
|
||||
scala> 55 ; (x: scala.Int) => x + 1 ; () => ((5))
|
||||
<console>:12: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; (x: scala.Int) => x + 1 ;;
|
||||
^
|
||||
res30: () => Int = <function>
|
||||
|
||||
scala>
|
||||
|
@ -183,9 +150,6 @@ scala> () => 5
|
|||
res31: () => Int = <function>
|
||||
|
||||
scala> 55 ; () => 5
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ;;
|
||||
^
|
||||
res32: () => Int = <function>
|
||||
|
||||
scala> () => { class X ; new X }
|
||||
|
|
|
@ -18,12 +18,6 @@ scala> ( (2 + 2 ) )
|
|||
res5: Int = 4
|
||||
|
||||
scala> 5 ; ( (2 + 2 ) ) ; ((5))
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; ( (2 + 2 ) ) ;;
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; ( (2 + 2 ) ) ;;
|
||||
^
|
||||
res6: Int = 5
|
||||
|
||||
scala> (((2 + 2)), ((2 + 2)))
|
||||
|
@ -38,18 +32,9 @@ res9: String = 4423
|
|||
scala>
|
||||
|
||||
scala> 55 ; ((2 + 2)) ; (1, 2, 3)
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; ((2 + 2)) ;;
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; ((2 + 2)) ;;
|
||||
^
|
||||
res10: (Int, Int, Int) = (1,2,3)
|
||||
|
||||
scala> 55 ; (x: Int) => x + 1 ; () => ((5))
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; (x: Int) => x + 1 ;;
|
||||
^
|
||||
res11: () => Int = <function>
|
||||
|
||||
scala>
|
||||
|
@ -58,9 +43,6 @@ scala> () => 5
|
|||
res12: () => Int = <function>
|
||||
|
||||
scala> 55 ; () => 5
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ;;
|
||||
^
|
||||
res13: () => Int = <function>
|
||||
|
||||
scala> () => { class X ; new X }
|
||||
|
|
|
@ -7,11 +7,9 @@ Try :help or completions for vals._ and power._
|
|||
scala> // guarding against "error: reference to global is ambiguous"
|
||||
|
||||
scala> global.emptyValDef // "it is imported twice in the same scope by ..."
|
||||
warning: one deprecation (since 2.11.0); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
res0: $r.global.noSelfType.type = private val _ = _
|
||||
|
||||
scala> val tp = ArrayClass[scala.util.Random] // magic with tags
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
tp: $r.global.Type = Array[scala.util.Random]
|
||||
|
||||
scala> tp.memberType(Array_apply) // evidence
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) }
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
c: (C, C{def f: Int}) forSome { type C <: AnyRef } = (C,C)
|
||||
|
||||
scala> :quit
|
||||
|
|
|
@ -5,9 +5,6 @@ scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() {
|
|||
defined class Foo
|
||||
|
||||
scala> val f = new Foo
|
||||
<console>:12: warning: class Foo is deprecated (since ReplTest version 1.0-FINAL): foooo
|
||||
val f = new Foo
|
||||
^
|
||||
f: Foo = Bippy
|
||||
|
||||
scala> :quit
|
||||
|
|
|
@ -3,15 +3,11 @@ scala> @deprecated(message="Please don't do that.", since="Time began.") def dep
|
|||
depp: String
|
||||
|
||||
scala> def a = depp
|
||||
warning: one deprecation (since Time began.); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
a: String
|
||||
|
||||
scala> :settings -deprecation
|
||||
|
||||
scala> def b = depp
|
||||
<console>:12: warning: method depp is deprecated (since Time began.): Please don't do that.
|
||||
def b = depp
|
||||
^
|
||||
b: String
|
||||
|
||||
scala> :quit
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
scala> def method : String = { implicit def f(s: Symbol) = "" ; 'symbol }
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
method: String
|
||||
|
||||
scala> :quit
|
||||
|
|
|
@ -3,28 +3,24 @@ scala> import scala.reflect.classTag
|
|||
import scala.reflect.classTag
|
||||
|
||||
scala> classManifest[scala.List[_]]
|
||||
warning: one deprecation (since 2.10.0); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
|
||||
|
||||
scala> classTag[scala.List[_]]
|
||||
res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
|
||||
|
||||
scala> classManifest[scala.collection.immutable.List[_]]
|
||||
warning: one deprecation (since 2.10.0); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
res2: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
|
||||
|
||||
scala> classTag[scala.collection.immutable.List[_]]
|
||||
res3: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
|
||||
|
||||
scala> classManifest[Predef.Set[_]]
|
||||
warning: one deprecation (since 2.10.0); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
res4: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>]
|
||||
|
||||
scala> classTag[Predef.Set[_]]
|
||||
res5: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set
|
||||
|
||||
scala> classManifest[scala.collection.immutable.Set[_]]
|
||||
warning: one deprecation (since 2.10.0); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
res6: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>]
|
||||
|
||||
scala> classTag[scala.collection.immutable.Set[_]]
|
||||
|
|
|
@ -6,7 +6,6 @@ scala> import scala.reflect.runtime._
|
|||
import scala.reflect.runtime._
|
||||
|
||||
scala> classManifest[List[_]]
|
||||
warning: one deprecation (since 2.10.0); for details, enable `:setting -deprecation' or `:replay -deprecation'
|
||||
res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
|
||||
|
||||
scala> scala.reflect.classTag[List[_]]
|
||||
|
|
|
@ -3,15 +3,12 @@ scala> class M[A]
|
|||
defined class M
|
||||
|
||||
scala> implicit def ma0[A](a: A): M[A] = null
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
ma0: [A](a: A)M[A]
|
||||
|
||||
scala> implicit def ma1[A](a: A): M[A] = null
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
ma1: [A](a: A)M[A]
|
||||
|
||||
scala> def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0
|
||||
warning: one feature warning; for details, enable `:setting -feature' or `:replay -feature'
|
||||
convert: [F[X <: F[X]]](builder: F[_ <: F[_]])Int
|
||||
|
||||
scala> convert(Some[Int](0))
|
||||
|
|
|
@ -15,33 +15,15 @@ scala> val z = x * y
|
|||
z: Int = 156
|
||||
|
||||
scala> 2 ; 3
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
2 ;;
|
||||
^
|
||||
res0: Int = 3
|
||||
|
||||
scala> { 2 ; 3 }
|
||||
<console>:12: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
|
||||
{ 2 ; 3 }
|
||||
^
|
||||
res1: Int = 3
|
||||
|
||||
scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
1 +
|
||||
2 +
|
||||
3 } ; bippy+88+11
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
|
||||
^
|
||||
defined object Cow
|
||||
defined class Moo
|
||||
bippy: Int
|
||||
|
@ -81,12 +63,6 @@ scala> ( (2 + 2 ) )
|
|||
res10: Int = 4
|
||||
|
||||
scala> 5 ; ( (2 + 2 ) ) ; ((5))
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; ( (2 + 2 ) ) ;;
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
5 ; ( (2 + 2 ) ) ;;
|
||||
^
|
||||
res11: Int = 5
|
||||
|
||||
scala> (((2 + 2)), ((2 + 2)))
|
||||
|
@ -101,18 +77,9 @@ res14: String = 4423
|
|||
scala>
|
||||
|
||||
scala> 55 ; ((2 + 2)) ; (1, 2, 3)
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; ((2 + 2)) ;;
|
||||
^
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; ((2 + 2)) ;;
|
||||
^
|
||||
res15: (Int, Int, Int) = (1,2,3)
|
||||
|
||||
scala> 55 ; (x: Int) => x + 1 ; () => ((5))
|
||||
<console>:12: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ; (x: Int) => x + 1 ;;
|
||||
^
|
||||
res16: () => Int = <function>
|
||||
|
||||
scala>
|
||||
|
@ -121,9 +88,6 @@ scala> () => 5
|
|||
res17: () => Int = <function>
|
||||
|
||||
scala> 55 ; () => 5
|
||||
<console>:11: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
|
||||
55 ;;
|
||||
^
|
||||
res18: () => Int = <function>
|
||||
|
||||
scala> () => { class X ; new X }
|
||||
|
|
|
@ -10,10 +10,6 @@ res1: Iterable[String] = MapLike.DefaultValuesIterable(eis)
|
|||
scala> :setting -Xmigration:any
|
||||
|
||||
scala> Map(1 -> "eis").values // warn
|
||||
<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
|
||||
`values` returns `Iterable[V]` rather than `Iterator[V]`.
|
||||
Map(1 -> "eis").values // warn
|
||||
^
|
||||
res2: Iterable[String] = MapLike.DefaultValuesIterable(eis)
|
||||
|
||||
scala> :setting -Xmigration:2.8
|
||||
|
@ -24,10 +20,6 @@ res3: Iterable[String] = MapLike.DefaultValuesIterable(eis)
|
|||
scala> :setting -Xmigration:2.7
|
||||
|
||||
scala> Map(1 -> "eis").values // warn
|
||||
<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
|
||||
`values` returns `Iterable[V]` rather than `Iterator[V]`.
|
||||
Map(1 -> "eis").values // warn
|
||||
^
|
||||
res4: Iterable[String] = MapLike.DefaultValuesIterable(eis)
|
||||
|
||||
scala> :setting -Xmigration:2.11
|
||||
|
@ -38,10 +30,6 @@ res5: Iterable[String] = MapLike.DefaultValuesIterable(eis)
|
|||
scala> :setting -Xmigration // same as :any
|
||||
|
||||
scala> Map(1 -> "eis").values // warn
|
||||
<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
|
||||
`values` returns `Iterable[V]` rather than `Iterator[V]`.
|
||||
Map(1 -> "eis").values // warn
|
||||
^
|
||||
res6: Iterable[String] = MapLike.DefaultValuesIterable(eis)
|
||||
|
||||
scala> :quit
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import scala.tools.partest._
|
||||
import java.io._
|
||||
import scala.tools.nsc._
|
||||
import scala.tools.cmd.CommandLineParser
|
||||
import scala.tools.nsc.doc.{Settings, DocFactory}
|
||||
import scala.tools.nsc, nsc.doc
|
||||
import scala.tools.nsc.doc.DocFactory
|
||||
import scala.tools.nsc.reporters.ConsoleReporter
|
||||
import scala.tools.partest.DirectTest
|
||||
|
||||
object Test extends DirectTest {
|
||||
|
||||
override def extraSettings: String = "-usejavacp -Xprint:parser -Yrangepos -Ystop-after:parser -d " + testOutput.path
|
||||
override def extraSettings: String = "-usejavacp -Xprint:parser -Yrangepos -Ystop-after:parser"
|
||||
|
||||
override def code = """
|
||||
// scala/bug#5527
|
||||
|
@ -143,11 +142,13 @@ object Test extends DirectTest {
|
|||
compile()
|
||||
System.setErr(prevErr)
|
||||
}
|
||||
|
||||
override def newCompiler(args: String*): Global = {
|
||||
// we want the Scaladoc compiler here, because it keeps DocDef nodes in the tree
|
||||
val settings = new Settings(_ => ())
|
||||
val command = new ScalaDoc.Command((CommandLineParser tokenize extraSettings) ++ args.toList, settings)
|
||||
new DocFactory(new ConsoleReporter(settings), settings).compiler
|
||||
// doc.Settings
|
||||
override def newSettings(args: List[String]) = {
|
||||
val s = new doc.Settings(_ => ())
|
||||
s.processArguments(args, true)
|
||||
s
|
||||
}
|
||||
// ScaladocGlobal yielded by DocFactory#compiler, requires doc.Settings
|
||||
// we want the Scaladoc compiler here, because it keeps DocDef nodes in the tree
|
||||
override def newCompiler(settings: nsc.Settings) = new DocFactory(reporter(settings), settings.asInstanceOf[doc.Settings]).compiler
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue