Skip to content

Commit 2b68e23

Browse files
committed
Third batch of neg -> warn test changes
1 parent 30bdc33 commit 2b68e23

File tree

13 files changed

+58
-56
lines changed

13 files changed

+58
-56
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ class CompilationTests {
216216
@Test def checkInitGlobal: Unit = {
217217
implicit val testGroup: TestGroup = TestGroup("checkInitGlobal")
218218
val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings")
219+
compileFilesInDir("tests/init-global/neg", options).checkExpectedErrors()
220+
compileFilesInDir("tests/init-global/pos", options).checkCompile()
219221
compileFilesInDir("tests/init-global/neg", options, FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkExpectedErrors()
222+
compileFilesInDir("tests/init-global/warn", defaultOptions.and("-Ysafe-init-global"), FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkWarnings()
220223
compileFilesInDir("tests/init-global/pos", options, FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyBlacklisted)).checkCompile()
221224
}
222225

tests/init-global/neg/i18628.scala renamed to tests/init-global/warn/i18628.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ object Test:
22
class Box(val x: Int)
33

44
def recur(a: => Box, b: => Box): Int =
5-
a.x + recur(a, b) + b.x // error // error
5+
a.x + recur(a, b) + b.x // warn // warn
66

77
recur(Box(1), Box(2))

tests/init-global/neg/i18628_2.scala renamed to tests/init-global/warn/i18628_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ object Test:
22
class Box(val x: Int)
33

44
def recur(a: => Box, b: Box): Int =
5-
a.x + recur(a, b) + b.x // error
5+
a.x + recur(a, b) + b.x // warn
66

77
recur(Box(1), Box(2))

tests/init-global/neg/i18628_3.scala renamed to tests/init-global/warn/i18628_3.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ object Test:
44
class Box(val x: Int)
55

66
def recur(a: => Box, b: => Box): Int =
7-
a.x + recur(a: @widen(5), b: @widen(5)) + b.x // error // error
7+
a.x + recur(a: @widen(5), b: @widen(5)) + b.x // warn // warn
88

99
recur(Box(1), Box(2))

tests/neg-deep-subtype/i4297.scala

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/neg-macros/i9570.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Error: tests/neg-macros/i9570.scala:15:21 ---------------------------------------------------------------------------
2+
15 | case '{HCons(_,$t)} => // error
3+
| ^
4+
| Use of `_` for lambda in quoted pattern. Use explicit lambda instead or use `$_` to match any term.

tests/neg-macros/i9570.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object Macros {
1212
private def sizeImpl(e: Expr[HList], n:Int)(using qctx:Quotes): Expr[Int] = {
1313
import quotes.reflect.*
1414
e match {
15-
case '{HCons(_,$t)} => // error if run with fatal warinings in BootstrappedOnlyCompilationTests
15+
case '{HCons(_,$t)} => // error
1616
sizeImpl(t,n+1)
1717
case '{HNil} => Expr(n)
1818
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Error: tests/neg-macros/macro-deprecation.scala:5:18 ----------------------------------------------------------------
2+
5 |inline def f = ${ impl } // error
3+
| ^^^^
4+
| method impl is deprecated

tests/neg-macros/macro-deprecation.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
import scala.quoted.*
44

55
inline def f = ${ impl } // error
6-
@deprecated def impl(using Quotes) = '{1}
6+
@deprecated def impl(using Quotes) = '{1}
Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
1-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:6:4 -------------------------------------------------------------
2-
6 | Value // error
1+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:6:4 -----------------------------------------------------------
2+
6 | Value // warn
33
| ^^^^^
44
| Could not transform call to scala.Enumeration.Value.
55
| The resulting program is unlikely to function properly as this operation requires reflection.
6-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:10:9 ------------------------------------------------------------
7-
10 | Value(4) // error
6+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:10:9 ----------------------------------------------------------
7+
10 | Value(4) // warn
88
| ^^^^^^^^
99
| Could not transform call to scala.Enumeration.Value.
1010
| The resulting program is unlikely to function properly as this operation requires reflection.
11-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:15:15 -----------------------------------------------------------
12-
15 | val a = Value(null) // error
11+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:15:15 ---------------------------------------------------------
12+
15 | val a = Value(null) // warn
1313
| ^^^^^^^^^^^
1414
| Passing null as name to scala.Enumeration.Value requires reflection at run-time.
1515
| The resulting program is unlikely to function properly.
16-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:16:15 -----------------------------------------------------------
17-
16 | val b = Value(10, null) // error
16+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:16:15 ---------------------------------------------------------
17+
16 | val b = Value(10, null) // warn
1818
| ^^^^^^^^^^^^^^^
1919
| Passing null as name to scala.Enumeration.Value requires reflection at run-time.
2020
| The resulting program is unlikely to function properly.
21-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:20:10 -----------------------------------------------------------
22-
20 | val a = new Val // error
21+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:20:10 ---------------------------------------------------------
22+
20 | val a = new Val // warn
2323
| ^^^^^^^
2424
| Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time.
2525
| The resulting program is unlikely to function properly.
26-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:21:10 -----------------------------------------------------------
27-
21 | val b = new Val(10) // error
26+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:21:10 ---------------------------------------------------------
27+
21 | val b = new Val(10) // warn
2828
| ^^^^^^^^^^^
2929
| Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time.
3030
| The resulting program is unlikely to function properly.
31-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:25:10 -----------------------------------------------------------
32-
25 | val a = new Val(null) // error
31+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:25:10 ---------------------------------------------------------
32+
25 | val a = new Val(null) // warn
3333
| ^^^^^^^^^^^^^
3434
| Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time.
3535
| The resulting program is unlikely to function properly.
36-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:26:10 -----------------------------------------------------------
37-
26 | val b = new Val(10, null) // error
36+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:26:10 ---------------------------------------------------------
37+
26 | val b = new Val(10, null) // warn
3838
| ^^^^^^^^^^^^^^^^^
3939
| Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time.
4040
| The resulting program is unlikely to function properly.
41-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:30:31 -----------------------------------------------------------
42-
30 | protected class Val1 extends Val // error
41+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:30:31 ---------------------------------------------------------
42+
30 | protected class Val1 extends Val // warn
4343
| ^^^
4444
| Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time.
4545
| The resulting program is unlikely to function properly.
46-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:31:31 -----------------------------------------------------------
47-
31 | protected class Val2 extends Val(1) // error
46+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:31:31 ---------------------------------------------------------
47+
31 | protected class Val2 extends Val(1) // warn
4848
| ^^^^^^
4949
| Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time.
5050
| The resulting program is unlikely to function properly.
51-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:35:31 -----------------------------------------------------------
52-
35 | protected class Val1 extends Val(null) // error
51+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:35:31 ---------------------------------------------------------
52+
35 | protected class Val1 extends Val(null) // warn
5353
| ^^^^^^^^^
5454
| Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time.
5555
| The resulting program is unlikely to function properly.
56-
-- Error: tests/neg-scalajs/enumeration-warnings.scala:36:31 -----------------------------------------------------------
57-
36 | protected class Val2 extends Val(1, null) // error
56+
-- Warning: tests/neg-scalajs/enumeration-warnings.scala:36:31 ---------------------------------------------------------
57+
36 | protected class Val2 extends Val(1, null) // warn
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.

tests/neg-scalajs/enumeration-warnings.scala

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,37 @@
33
class UnableToTransformValue extends Enumeration {
44
val a = {
55
println("oh, oh!")
6-
Value // error
6+
Value // warn
77
}
88
val b = {
99
println("oh, oh!")
10-
Value(4) // error
10+
Value(4) // warn
1111
}
1212
}
1313

1414
class ValueWithNullName extends Enumeration {
15-
val a = Value(null) // error
16-
val b = Value(10, null) // error
15+
val a = Value(null) // warn
16+
val b = Value(10, null) // warn
1717
}
1818

1919
class NewValWithNoName extends Enumeration {
20-
val a = new Val // error
21-
val b = new Val(10) // error
20+
val a = new Val // warn
21+
val b = new Val(10) // warn
2222
}
2323

2424
class NewValWithNullName extends Enumeration {
25-
val a = new Val(null) // error
26-
val b = new Val(10, null) // error
25+
val a = new Val(null) // warn
26+
val b = new Val(10, null) // warn
2727
}
2828

2929
class ExtendsValWithNoName extends Enumeration {
30-
protected class Val1 extends Val // error
31-
protected class Val2 extends Val(1) // error
30+
protected class Val1 extends Val // warn
31+
protected class Val2 extends Val(1) // warn
3232
}
3333

3434
class ExtendsValWithNullName extends Enumeration {
35-
protected class Val1 extends Val(null) // error
36-
protected class Val2 extends Val(1, null) // error
35+
protected class Val1 extends Val(null) // warn
36+
protected class Val2 extends Val(1, null) // warn
3737
}
38+
39+
// nopos-error: No warnings can be incurred under -Werror.

tests/patmat/i14407.dupe.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
6: Match case Unreachable
2+
0: No Kind

tests/run/getclass.check

Lines changed: 2 additions & 2 deletions
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/

0 commit comments

Comments
 (0)