Skip to content

Respect -deprecation flag #5225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/reporting/Reporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ trait Reporting { this: Context =>
}

def deprecationWarning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
reportWarning(new DeprecationWarning(msg, pos))
if (this.settings.deprecation.value) reportWarning(new DeprecationWarning(msg, pos))

def migrationWarning(msg: => Message, pos: SourcePosition = NoSourcePosition): Unit =
reportWarning(new MigrationWarning(msg, pos))
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ object Checking {
def checkRefinementNonCyclic(refinement: Tree, refineCls: ClassSymbol, seen: mutable.Set[Symbol])
(implicit ctx: Context): Unit = {
def flag(what: String, tree: Tree) =
ctx.deprecationWarning(i"$what reference in refinement is deprecated", tree.pos)
ctx.warning(i"$what reference in refinement is deprecated", tree.pos)
def forwardRef(tree: Tree) = flag("forward", tree)
def selfRef(tree: Tree) = flag("self", tree)
val checkTree = new TreeAccumulator[Unit] {
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class CompilationTests extends ParallelTesting {
compileFilesInDir("tests/neg", defaultOptions) +
compileFilesInDir("tests/neg-tailcall", defaultOptions) +
compileFilesInDir("tests/neg-kind-polymorphism", defaultOptions and "-Ykind-polymorphism") +
compileFilesInDir("tests/neg-custom-args/deprecation", defaultOptions.and("-Xfatal-warnings", "-deprecation")) +
compileFilesInDir("tests/neg-custom-args/fatal-warnings", defaultOptions.and("-Xfatal-warnings")) +
compileFilesInDir("tests/neg-custom-args/allow-double-bindings", allowDoubleBindings) +
compileDir("tests/neg-custom-args/impl-conv", defaultOptions.and("-Xfatal-warnings", "-feature")) +
Expand Down
8 changes: 8 additions & 0 deletions tests/pos-special/fatal-warnings/deprecation.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object A {
@deprecated("use bar instead of this one", "0.2.3")
def foo: Int = 3
}

object B {
A.foo
}