From 71a66c4d8b31f3c2189e5724c7cf31a20377a24a Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Mon, 20 Nov 2023 15:49:01 +0100 Subject: [PATCH] Fix checks outside of testCompilation --- compiler/test-resources/repl/rewrite-messages | 13 ++++++++----- tests/neg-macros/i9570.check | 5 +++++ tests/neg-macros/i9570.scala | 4 +++- tests/neg-macros/macro-deprecation.check | 5 +++++ tests/neg-macros/macro-deprecation.scala | 4 +++- tests/patmat/i14407.dupe.check | 1 + tests/patmat/i18118.check | 1 + 7 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 tests/neg-macros/i9570.check create mode 100644 tests/neg-macros/macro-deprecation.check diff --git a/compiler/test-resources/repl/rewrite-messages b/compiler/test-resources/repl/rewrite-messages index a63a72195019..393b87ee272b 100644 --- a/compiler/test-resources/repl/rewrite-messages +++ b/compiler/test-resources/repl/rewrite-messages @@ -1,17 +1,20 @@ //> using options -source:future-migration -deprecation -Werror scala> import scala.util._ --- Error: ---------------------------------------------------------------------- +-- Migration Warning: ---------------------------------------------------------- 1 | import scala.util._ | ^ | `_` is no longer supported for a wildcard import; use `*` instead - +No warnings can be incurred under -Werror. +1 warning found +1 error found scala> extension (x: Int) def foo(y: Int) = x + y def foo(x: Int)(y: Int): Int - scala> 2 foo 4 --- Error: ---------------------------------------------------------------------- +-- Migration Warning: ---------------------------------------------------------- 1 | 2 foo 4 | ^^^ |Alphanumeric method foo is not declared infix; it should not be used as infix operator. |Instead, use method syntax .foo(...) or backticked identifier `foo`. -1 error found +No warnings can be incurred under -Werror. +1 warning found +1 error found \ No newline at end of file diff --git a/tests/neg-macros/i9570.check b/tests/neg-macros/i9570.check new file mode 100644 index 000000000000..16b71d317b7c --- /dev/null +++ b/tests/neg-macros/i9570.check @@ -0,0 +1,5 @@ +-- Warning: tests/neg-macros/i9570.scala:15:21 ------------------------------------------------------------------------- +15 | case '{HCons(_,$t)} => // warn (in .check file) + | ^ + | Use of `_` for lambda in quoted pattern. Use explicit lambda instead or use `$_` to match any term. +No warnings can be incurred under -Werror. diff --git a/tests/neg-macros/i9570.scala b/tests/neg-macros/i9570.scala index 9242fd2e9bbd..8afd76fc7181 100644 --- a/tests/neg-macros/i9570.scala +++ b/tests/neg-macros/i9570.scala @@ -12,7 +12,7 @@ object Macros { private def sizeImpl(e: Expr[HList], n:Int)(using qctx:Quotes): Expr[Int] = { import quotes.reflect.* e match { - case '{HCons(_,$t)} => // error if run with fatal warinings in BootstrappedOnlyCompilationTests + case '{HCons(_,$t)} => // warn (in .check file) sizeImpl(t,n+1) case '{HNil} => Expr(n) } @@ -24,3 +24,5 @@ object Macros { } } + +// nopos-error No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-macros/macro-deprecation.check b/tests/neg-macros/macro-deprecation.check new file mode 100644 index 000000000000..5ce8a2427127 --- /dev/null +++ b/tests/neg-macros/macro-deprecation.check @@ -0,0 +1,5 @@ +-- Deprecation Warning: tests/neg-macros/macro-deprecation.scala:5:18 -------------------------------------------------- +5 |inline def f = ${ impl } // warn (in .check file) + | ^^^^ + | method impl is deprecated +No warnings can be incurred under -Werror. diff --git a/tests/neg-macros/macro-deprecation.scala b/tests/neg-macros/macro-deprecation.scala index ad1cdda001bb..0bbf4d5faa1e 100644 --- a/tests/neg-macros/macro-deprecation.scala +++ b/tests/neg-macros/macro-deprecation.scala @@ -2,5 +2,7 @@ import scala.quoted.* -inline def f = ${ impl } // error +inline def f = ${ impl } // warn (in .check file) @deprecated def impl(using Quotes) = '{1} + +// nopos-error No warnings can be incurred under -Werror. diff --git a/tests/patmat/i14407.dupe.check b/tests/patmat/i14407.dupe.check index b0605bcd95e5..e6f742314d98 100644 --- a/tests/patmat/i14407.dupe.check +++ b/tests/patmat/i14407.dupe.check @@ -1 +1,2 @@ 6: Match case Unreachable +0: No Kind diff --git a/tests/patmat/i18118.check b/tests/patmat/i18118.check index 8861eb273fb9..f7ad777f5e8c 100644 --- a/tests/patmat/i18118.check +++ b/tests/patmat/i18118.check @@ -2,3 +2,4 @@ 21: Pattern Match 32: Pattern Match 41: Pattern Match +0: No Kind