diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index 1c6c60073a9f..aa6aebe17146 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -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)) diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index a853965ea1bf..a85f92bcf43b 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -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] { diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 8809cdd2f90e..566b6bcbf4cb 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -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")) + diff --git a/tests/neg-custom-args/fatal-warnings/i2333.scala b/tests/neg-custom-args/deprecation/i2333.scala similarity index 100% rename from tests/neg-custom-args/fatal-warnings/i2333.scala rename to tests/neg-custom-args/deprecation/i2333.scala diff --git a/tests/neg-custom-args/fatal-warnings/t3235-minimal.scala b/tests/neg-custom-args/deprecation/t3235-minimal.scala similarity index 100% rename from tests/neg-custom-args/fatal-warnings/t3235-minimal.scala rename to tests/neg-custom-args/deprecation/t3235-minimal.scala diff --git a/tests/pos-special/fatal-warnings/deprecation.scala b/tests/pos-special/fatal-warnings/deprecation.scala new file mode 100644 index 000000000000..2b24b1094c87 --- /dev/null +++ b/tests/pos-special/fatal-warnings/deprecation.scala @@ -0,0 +1,8 @@ +object A { + @deprecated("use bar instead of this one", "0.2.3") + def foo: Int = 3 +} + +object B { + A.foo +}