Skip to content

Commit e410ad4

Browse files
committed
Review changes
1 parent d344430 commit e410ad4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+69
-66
lines changed

compiler/src/dotty/tools/dotc/reporting/Reporter.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ abstract class Reporter extends interfaces.ReporterResult {
209209
def incomplete(dia: Diagnostic)(using Context): Unit =
210210
incompleteHandler(dia, ctx)
211211

212-
def finalizeReporting()(using Context) =
212+
def finalizeReporting()(using Context) =
213213
if (hasWarnings && ctx.settings.XfatalWarnings.value)
214-
report(new Error("No warnings can be incurred under -Werror.", NoSourcePosition))
214+
report(new Error("No warnings can be incurred under -Werror (or -Xfatal-warnings)", NoSourcePosition))
215215

216216
/** Summary of warnings and errors */
217217
def summary: String = {

compiler/test-resources/repl/rewrite-messages

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ scala> import scala.util._
44
1 | import scala.util._
55
| ^
66
| `_` is no longer supported for a wildcard import; use `*` instead
7-
No warnings can be incurred under -Werror.
7+
No warnings can be incurred under -Werror (or -Xfatal-warnings)
88
1 warning found
99
1 error found
1010
scala> extension (x: Int) def foo(y: Int) = x + y
@@ -15,6 +15,6 @@ scala> 2 foo 4
1515
| ^^^
1616
|Alphanumeric method foo is not declared infix; it should not be used as infix operator.
1717
|Instead, use method syntax .foo(...) or backticked identifier `foo`.
18-
No warnings can be incurred under -Werror.
18+
No warnings can be incurred under -Werror (or -Xfatal-warnings)
1919
1 warning found
2020
1 error found

compiler/test/dotty/tools/dotc/CompilationTests.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,8 @@ class CompilationTests {
215215
// initialization tests
216216
@Test def checkInitGlobal: Unit = {
217217
implicit val testGroup: TestGroup = TestGroup("checkInitGlobal")
218-
val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings")
219218
compileFilesInDir("tests/init-global/warn", defaultOptions.and("-Ysafe-init-global"), FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkWarnings()
220-
compileFilesInDir("tests/init-global/pos", options, FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyBlacklisted)).checkCompile()
219+
compileFilesInDir("tests/init-global/pos", defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings"), FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyBlacklisted)).checkCompile()
221220
}
222221

223222
// initialization tests

tests/neg-custom-args/sourcepath2/hi/A.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
| class Hello is in the wrong directory.
55
| It was declared to be in package <empty>
66
| But it is found in directory hi
7-
No warnings can be incurred under -Werror.
7+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg-macros/i9570.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
15 | case '{HCons(_,$t)} => // warn (in .check file)
33
| ^
44
| Use of `_` for lambda in quoted pattern. Use explicit lambda instead or use `$_` to match any term.
5-
No warnings can be incurred under -Werror.
5+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg-macros/i9570.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ object Macros {
2020

2121
inline def size(inline expr: HList ): Int = {
2222
${sizeImpl('expr,0)}
23-
}
23+
}
2424

2525
}
2626
}
2727

28-
// nopos-error No warnings can be incurred under -Werror.
28+
// nopos-error No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg-macros/macro-deprecation.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
5 |inline def f = ${ impl } // warn (in .check file)
33
| ^^^^
44
| method impl is deprecated
5-
No warnings can be incurred under -Werror.
5+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg-macros/macro-deprecation.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import scala.quoted.*
55
inline def f = ${ impl } // warn (in .check file)
66
@deprecated def impl(using Quotes) = '{1}
77

8-
// nopos-error No warnings can be incurred under -Werror.
8+
// nopos-error No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg-scalajs/enumeration-warnings.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@
5858
| ^^^^^^^^^^^^
5959
| Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time.
6060
| The resulting program is unlikely to function properly.
61-
No warnings can be incurred under -Werror.
61+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg-scalajs/enumeration-warnings.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ class ExtendsValWithNullName extends Enumeration {
3636
protected class Val2 extends Val(1, null) // warn
3737
}
3838

39-
// nopos-error: No warnings can be incurred under -Werror.
39+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/adhoc-extension/B.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ object O {
88
val a = new A {} // warn
99
object E extends A // warn
1010
}
11-
// nopos-error: No warnings can be incurred under -Werror.
11+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/capt-wf.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ def test(c: Cap, other: String): Unit =
3535
val y3: String^{ev} = ??? // error cs is empty
3636

3737
()
38-
// nopos-error: No warnings can be incurred under -Werror.
38+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/classtag-typetest/3_1-migration.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ import scala.reflect.ClassTag
66
def f3_1m[T: ClassTag](x: Any): Unit =
77
x match
88
case _: T => // warn
9-
// nopos-error: No warnings can be incurred under -Werror.
9+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/classtag-typetest/3_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ import scala.reflect.ClassTag
66
def f3_1[T: ClassTag](x: Any): Unit =
77
x match
88
case _: T => // warn
9-
// nopos-error: No warnings can be incurred under -Werror.
9+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i12188/Test.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ def foo(x: P): Unit =
1010
x match // warn
1111
case _: PC1 =>
1212

13-
// nopos-error: No warnings can be incurred under -Werror.
13+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i13946/BadPrinter.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
import language.future
55
class BadPrinter extends Printer: // warn
66
override def print(s: String): Unit = println("Bad!!!")
7-
// nopos-error: No warnings can be incurred under -Werror.
7+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i14386.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ def braced() =
4646
log(level, msg) // warn
4747
}
4848
end"""
49-
// nopos-error: No warnings can be incurred under -Werror.
49+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i15474b.check

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
-- Error: tests/neg/i15474b.scala:7:40 ---------------------------------------------------------------------------------
2-
7 | def apply(from: String): Int = from.toInt // error: infinite loop in function body
1+
-- Warning: tests/neg/i15474b.scala:7:40 -------------------------------------------------------------------------------
2+
7 | def apply(from: String): Int = from.toInt // warn: infinite loop in function body
33
| ^^^^^^^^^^
44
| Infinite loop in function body
55
| Test1.c.apply(from).toInt
6+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i15474b.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import scala.language.implicitConversions
44

55
object Test1:
66
given c: Conversion[ String, Int ] with
7-
def apply(from: String): Int = from.toInt // error: infinite loop in function body
8-
7+
def apply(from: String): Int = from.toInt // warn: infinite loop in function body
8+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i16876/Test.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ object Foo {
77
private def myMethodFailing(a: Int, b: Int, c: Int) = a + 0 // warn // warn
88
myMethodFailing(1, 2, 3)
99
}
10-
// nopos-error: No warnings can be incurred under -Werror.
10+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i17612b.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn
3131
| ^
3232
| value z in class UnderDerived shadows field z inherited from trait Base
33-
No warnings can be incurred under -Werror.
33+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i17612b/i17612b.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ object i17612b:
4242

4343
def main(args: Array[String]) =
4444
val derived = new Derived(1, 1, 1, 1)
45-
// nopos-error: No warnings can be incurred under -Werror.
45+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i17613b.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@
5858
42 | class InnerCl[ImClassR] // warn
5959
| ^^^^^^^^
6060
| Type parameter ImClassR for class InnerCl shadows an explicitly renamed type : ImClassR
61-
No warnings can be incurred under -Werror.
61+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i4986d.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ trait Bar[A]
2222
type Barable[A] = {
2323
def bar(implicit ev: Bar[A]): Any // ok
2424
}
25-
// nopos-error: No warnings can be incurred under -Werror.
25+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i6716.check

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- Error: tests/neg/i6716.scala:12:39 ----------------------------------------------------------------------------------
2-
12 | given Monad[Bar] = summon[Monad[Foo]] // error
1+
-- Warning: tests/neg/i6716.scala:12:39 --------------------------------------------------------------------------------
2+
12 | given Monad[Bar] = summon[Monad[Foo]] // warn
33
| ^
44
| Result of implicit search for Monad[Foo] will change.
55
| Current result Bar.given_Monad_Bar will be no longer eligible
@@ -13,3 +13,4 @@
1313
| - rearrange definitions so that Bar.given_Monad_Bar comes earlier,
1414
| - use an explicit argument.
1515
| This will be an error in Scala 3.5 and later.
16+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i6716.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ object Foo {
99

1010
opaque type Bar = Foo
1111
object Bar {
12-
given Monad[Bar] = summon[Monad[Foo]] // error
12+
given Monad[Bar] = summon[Monad[Foo]] // warn
1313
}
1414

1515
object Test extends App {
1616
println(summon[Monad[Foo]].id)
1717
println(summon[Monad[Bar]].id)
18-
}
18+
}
19+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i7294-a.check

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
-- [E007] Type Mismatch Error: tests/neg/i7294-a.scala:10:20 -----------------------------------------------------------
2-
10 | case x: T => x.g(10) // error // error
2+
10 | case x: T => x.g(10) // error
33
| ^^^^^^^
44
| Found: Any
55
| Required: T
66
|
77
| where: T is a type in given instance f with bounds <: foo.Foo
88
|
99
| longer explanation available when compiling with `-explain`
10-
-- Error: tests/neg/i7294-a.scala:10:12 --------------------------------------------------------------------------------
11-
10 | case x: T => x.g(10) // error // error
10+
-- Warning: tests/neg/i7294-a.scala:10:12 ------------------------------------------------------------------------------
11+
10 | case x: T => x.g(10) // error
1212
| ^
1313
| Result of implicit search for scala.reflect.TypeTest[Nothing, T] will change.
1414
| Current result foo.Test.f will be no longer eligible
@@ -24,3 +24,4 @@
2424
| This will be an error in Scala 3.5 and later.
2525
|
2626
| where: T is a type in given instance f with bounds <: foo.Foo
27+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i7294-a.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ trait Foo { def g(x: Int): Any }
77
object Test:
88

99
inline given f[T <: Foo]: T = ??? match {
10-
case x: T => x.g(10) // error // error
10+
case x: T => x.g(10) // error
1111
}
1212

1313
@main def Test = f
14+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i7294-b.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ package foo
55
trait Foo { def g(x: Any): Any }
66

77
inline given f[T <: Foo]: T = ??? match {
8-
case x: T => x.g(10) // error // error
8+
case x: T => x.g(10) // error
99
}
1010

1111
@main def Test = f
12+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i8681.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ val b = (A(1): A | B) match {
1414
case B(_) => "OK"
1515
case C(_) => "NOT OK" // error
1616
}
17-
// nopos-error: No warnings can be incurred under -Werror.
17+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i8711.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
14 | case x: C => x // error
1919
| ^
2020
| this case is unreachable since type A | B and class C are unrelated
21-
No warnings can be incurred under -Werror.
21+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i8711.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ object Test {
2121
}
2222
}
2323

24-
// nopos-error: No warnings can be incurred under -Werror.
24+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i9408b.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
8 | val length: Int = "abc" // warn
44
| ^^^^^
55
|The conversion (test.conversions.Conv.implicitLength : String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views.
6-
No warnings can be incurred under -Werror.
6+
No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/i9408b/Test_2.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ object Test {
88
val length: Int = "abc" // warn
99
}
1010

11-
// nopos-error: No warnings can be incurred under -Werror.
11+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/impl-conv/B.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ object B {
1010
val x: Int = "" // ok
1111
val y: String = 1 // warn: feature
1212
}
13-
// nopos-error: No warnings can be incurred under -Werror.
13+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/indentLeft.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//> using options -Xfatal-warnings
2-
// nopos-error: No warnings can be incurred under -Werror.
2+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)
33

44
object Test {
55

tests/neg/indentRight.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ object Test {
3333

3434
println("!") // error: expected a toplevel definition
3535
}
36-
// nopos-error: No warnings can be incurred under -Werror.
36+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/looping-givens.scala

-11
This file was deleted.

tests/neg/missing-targetName.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class & { // error
99
val frozen_& : Int = ??? // warn
1010
object some_??? // warn
1111
}
12-
// nopos-error: No warnings can be incurred under -Werror.
12+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/pureStatement.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ object Test {
3232
broken.foo // no extra error, and no pure expression warning
3333
broken.foo() // same
3434
}
35-
// nopos-error: No warnings can be incurred under -Werror.
35+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/structural-2.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ package p6 {
7373
}
7474

7575
}
76-
// nopos-error: No warnings can be incurred under -Werror.
76+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/neg/unchecked-patterns.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ object Test {
2525
val Pair(t1, t2) = (5, 5) // OK
2626
val Triple(u1, u2, u3) = (5, 5, 5) // OK
2727
}
28-
// nopos-error: No warnings can be incurred under -Werror.
28+
// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings)

tests/run/getclass.check

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ class [D
2222
class [Lscala.collection.immutable.List;
2323

2424
Functions:
25-
class Test$$$Lambda$
26-
class Test$$$Lambda$
25+
class Test$$$Lambda/
26+
class Test$$$Lambda/

tests/neg/i19506.scala renamed to tests/warn/i19506.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ trait Reader[T]
44
def read[T: Reader](s: String, trace: Boolean = false): T = ???
55

66
def Test =
7-
read[Object]("") // error
8-
read[Object]("")() // error
7+
read[Object]("") // warn
8+
read[Object]("")() // warn

tests/warn/looping-givens.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class A
2+
class B
3+
4+
given joint(using a: A, b: B): (A & B) = ???
5+
6+
def foo(using a: A, b: B) =
7+
given aa: A = summon // warn
8+
given bb: B = summon // warn
9+
given ab: (A & B) = summon // warn

0 commit comments

Comments
 (0)