Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Commit 2f78ddd

Browse files
committed
Merge pull request scala#3955 from som-snytt/issue/8410
SI-8410 Don't warn fatally on disabled flag
2 parents 816c399 + 6076d61 commit 2f78ddd

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/compiler/scala/tools/nsc/Reporting.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w
3333
if (option) reporter.warning(pos, msg)
3434
else if (!(warnings contains pos)) warnings += ((pos, msg))
3535
def summarize() =
36-
if (warnings.nonEmpty && (option.isDefault || settings.fatalWarnings)) {
36+
if (warnings.nonEmpty && (option.isDefault || option)) {
3737
val numWarnings = warnings.size
3838
val warningVerb = if (numWarnings == 1) "was" else "were"
3939
val warningCount = countElementsAsString(numWarnings, s"$what warning")
@@ -105,4 +105,4 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w
105105
reporter.error(NoPosition, "No warnings can be incurred under -Xfatal-warnings.")
106106
}
107107
}
108-
}
108+
}

test/files/pos/t8410.flags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-optimise -Xfatal-warnings -deprecation:false -Yinline-warnings:false

test/files/pos/t8410.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
object Test extends App {
3+
@deprecated("","") def f = 42
4+
@deprecated("","") def z = f
5+
def g = { @deprecated("","") def _f = f ; _f } // warns in 2.11.0-M8
6+
def x = { @deprecated("","") class X { def x = f } ; new X().x } // warns in 2.11.0-M8
7+
Console println g
8+
Console println f // warns
9+
10+
@deprecated("","") trait T
11+
object T extends T { def t = f }
12+
Console println T.t
13+
14+
def k = List(0).dropWhile(_ < 1) // inlining warns doubly
15+
}

0 commit comments

Comments
 (0)