Skip to content

Commit 1110aac

Browse files
committed
Don't discard warnings in TestReporter for .check files of neg tests
1 parent 77769c1 commit 1110aac

File tree

6 files changed

+31
-9
lines changed

6 files changed

+31
-9
lines changed

compiler/test/dotty/tools/dotc/reporting/TestReporter.scala

+3-9
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,9 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
7373
case _ => ""
7474
}
7575

76-
dia match {
77-
case dia: Error => {
78-
_errorBuf.append(dia)
79-
_consoleReporter.doReport(dia)
80-
printMessageAndPos(dia, extra)
81-
}
82-
case dia =>
83-
printMessageAndPos(dia, extra)
84-
}
76+
if dia.level >= ERROR then _errorBuf.append(dia)
77+
if dia.level >= WARNING then _consoleReporter.doReport(dia)
78+
printMessageAndPos(dia, extra)
8579
}
8680
}
8781

tests/neg-scalajs/jsname-argument.check

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
42 | @JSName(new NamesClass().a) // error
2323
| ^^^^^^^^^^^^^^^^^^
2424
| A js.Symbol argument to JSName must be a static, stable identifier
25+
-- Warning: tests/neg-scalajs/jsname-argument.scala:49:10 --------------------------------------------------------------
26+
49 | @JSName(a) // warning, untested
27+
| ^
28+
|This symbol is defined in the same object as the annotation's target. This will cause a stackoverflow at runtime
2529
-- Error: tests/neg-scalajs/jsname-argument.scala:57:3 -----------------------------------------------------------------
2630
57 | @JSName(Names.sym) // error
2731
| ^^^^^^^^^^^^^^^^^^

tests/neg/i12150.check

+6
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
44
| expression expected but end found
55

66
longer explanation available when compiling with `-explain`
7+
-- [E129] Potential Issue Warning: tests/neg/i12150.scala:1:11 ---------------------------------------------------------
8+
1 |def f: Unit = // error
9+
| ^
10+
| A pure expression does nothing in statement position; you may be omitting necessary parentheses
11+
12+
longer explanation available when compiling with `-explain`

tests/neg/i2033.check

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@
99
| Required: String
1010

1111
longer explanation available when compiling with `-explain`
12+
-- Warning: tests/neg/i2033.scala:6:37 ---------------------------------------------------------------------------------
13+
6 | val out = new ObjectOutputStream(println)
14+
| ^^^^^^^
15+
|method println is eta-expanded even though java.io.OutputStream does not have the @FunctionalInterface annotation.

tests/neg/spaces-vs-tabs.check

+6
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@
2828
| The start of this line does not match any of the previous indentation widths.
2929
| Indentation width of current line : 1 tab, 2 spaces
3030
| This falls between previous widths: 1 tab and 1 tab, 4 spaces
31+
-- [E129] Potential Issue Warning: tests/neg/spaces-vs-tabs.scala:13:6 -------------------------------------------------
32+
13 | 1
33+
| ^
34+
| A pure expression does nothing in statement position; you may be omitting necessary parentheses
35+
36+
longer explanation available when compiling with `-explain`

tests/neg/t6810.check

+8
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@
2222
30 | val b = '
2323
| ^
2424
| unclosed character literal
25+
-- Warning: tests/neg/t6810.scala:6:0 ----------------------------------------------------------------------------------
26+
6 |' // but not embedded EOL sequences not represented as escapes
27+
|^
28+
|Line is indented too far to the left, or a `}` is missing
29+
-- Warning: tests/neg/t6810.scala:31:0 ---------------------------------------------------------------------------------
30+
31 |' // anypos-error CR seen as EOL by scanner; FSR, error only on open quote, unlike `y`
31+
|^
32+
|Line is indented too far to the left, or a `}` is missing

0 commit comments

Comments
 (0)