From d34443092ff1eb7ea5e0f8e25569723175c815ff Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Fri, 26 Jan 2024 17:25:42 +0100 Subject: [PATCH] Fixed warn tests for init-global --- .../dotty/tools/dotc/CompilationTests.scala | 1 - tests/init-global/warn/global-cycle1.check | 15 +++--- tests/init-global/warn/global-cycle1.scala | 5 +- tests/init-global/warn/global-cycle14.check | 15 +++--- tests/init-global/warn/global-cycle14.scala | 5 +- tests/init-global/warn/global-cycle2.check | 7 ++- tests/init-global/warn/global-cycle2.scala | 3 +- tests/init-global/warn/global-cycle3.check | 7 ++- tests/init-global/warn/global-cycle3.scala | 3 +- tests/init-global/warn/global-cycle4.check | 7 ++- tests/init-global/warn/global-cycle4.scala | 3 +- tests/init-global/warn/global-cycle5.check | 7 ++- tests/init-global/warn/global-cycle5.scala | 4 +- tests/init-global/warn/global-cycle6.check | 15 +++--- tests/init-global/warn/global-cycle6.scala | 6 +-- tests/init-global/warn/global-cycle7.check | 15 +++--- tests/init-global/warn/global-cycle7.scala | 5 +- tests/init-global/warn/global-cycle8.check | 7 ++- tests/init-global/warn/global-cycle8.scala | 3 +- .../warn/global-irrelevance1.check | 7 ++- .../warn/global-irrelevance1.scala | 2 +- .../warn/global-irrelevance2.check | 7 ++- .../warn/global-irrelevance2.scala | 3 +- .../warn/global-irrelevance3.check | 7 ++- .../warn/global-irrelevance3.scala | 3 +- .../warn/global-irrelevance4.check | 7 ++- .../warn/global-irrelevance4.scala | 3 +- .../warn/global-irrelevance5.check | 7 ++- .../warn/global-irrelevance5.scala | 3 +- .../warn/global-irrelevance6.check | 7 ++- .../warn/global-irrelevance6.scala | 3 +- .../warn/global-irrelevance7.check | 7 ++- .../warn/global-irrelevance7.scala | 3 +- tests/init-global/warn/global-list.check | 51 +++++++++---------- tests/init-global/warn/global-list.scala | 4 +- tests/init-global/warn/global-local-var.check | 7 ++- tests/init-global/warn/global-local-var.scala | 3 +- tests/init-global/warn/global-region1.check | 19 ++++--- tests/init-global/warn/global-region1.scala | 3 +- tests/init-global/warn/i11262.check | 15 +++--- tests/init-global/warn/i11262.scala | 5 +- tests/init-global/warn/i12544b.check | 15 +++--- tests/init-global/warn/i12544b.scala | 5 +- tests/init-global/warn/i9176.check | 7 ++- tests/init-global/warn/i9176.scala | 3 +- tests/init-global/warn/line-spacing.check | 7 ++- tests/init-global/warn/line-spacing.scala | 3 +- tests/init-global/warn/mutable-array.check | 7 ++- tests/init-global/warn/mutable-array.scala | 3 +- tests/init-global/warn/mutable-read1.check | 7 ++- tests/init-global/warn/mutable-read1.scala | 2 +- tests/init-global/warn/mutable-read2.check | 7 ++- tests/init-global/warn/mutable-read2.scala | 2 +- tests/init-global/warn/mutable-read3.check | 7 ++- tests/init-global/warn/mutable-read3.scala | 2 +- tests/init-global/warn/mutable-read4.check | 7 ++- tests/init-global/warn/mutable-read4.scala | 2 +- tests/init-global/warn/mutable-read5.check | 7 ++- tests/init-global/warn/mutable-read5.scala | 4 +- tests/init-global/warn/mutable-read6.check | 7 ++- tests/init-global/warn/mutable-read6.scala | 4 +- tests/init-global/warn/mutable-read7.check | 7 ++- tests/init-global/warn/mutable-read7.scala | 4 +- tests/init-global/warn/mutable-read8.check | 7 ++- tests/init-global/warn/mutable-read8.scala | 4 +- tests/init-global/warn/partial-ordering.check | 7 ++- tests/init-global/warn/partial-ordering.scala | 4 +- .../init-global/warn/patmat-unapplySeq.check | 7 ++- .../init-global/warn/patmat-unapplySeq.scala | 3 +- .../init-global/warn/patmat-unapplySeq2.check | 7 ++- .../init-global/warn/patmat-unapplySeq2.scala | 3 +- tests/init-global/warn/patmat.check | 13 +++-- tests/init-global/warn/patmat.scala | 5 +- tests/init-global/warn/return.check | 7 ++- tests/init-global/warn/return.scala | 3 +- tests/init-global/warn/return2.check | 11 ++-- tests/init-global/warn/return2.scala | 5 +- tests/init-global/warn/t5366.check | 15 +++--- tests/init-global/warn/t5366.scala | 6 +-- tests/init-global/warn/t9115.check | 15 +++--- tests/init-global/warn/t9115.scala | 5 +- tests/init-global/warn/t9261.check | 7 ++- tests/init-global/warn/t9261.scala | 3 +- tests/init-global/warn/t9312.check | 15 +++--- tests/init-global/warn/t9312.scala | 5 +- tests/init-global/warn/t9360.check | 15 +++--- tests/init-global/warn/t9360.scala | 5 +- .../warn/unapply-implicit-arg.check | 7 ++- .../warn/unapply-implicit-arg.scala | 4 +- .../warn/unapply-implicit-arg2.check | 23 ++++----- .../warn/unapply-implicit-arg2.scala | 3 +- .../warn/unapply-implicit-arg3.check | 7 ++- .../warn/unapply-implicit-arg3.scala | 3 +- .../warn/unapplySeq-implicit-arg.check | 7 ++- .../warn/unapplySeq-implicit-arg.scala | 3 +- .../warn/unapplySeq-implicit-arg2.check | 7 ++- .../warn/unapplySeq-implicit-arg2.scala | 3 +- .../warn/unapplySeq-implicit-arg3.check | 7 ++- .../warn/unapplySeq-implicit-arg3.scala | 3 +- 99 files changed, 299 insertions(+), 383 deletions(-) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 95b5362d77c0..d1ec6eeda0bd 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -216,7 +216,6 @@ class CompilationTests { @Test def checkInitGlobal: Unit = { implicit val testGroup: TestGroup = TestGroup("checkInitGlobal") val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings") - compileFilesInDir("tests/init-global/neg", options, FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkExpectedErrors() compileFilesInDir("tests/init-global/warn", defaultOptions.and("-Ysafe-init-global"), FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkWarnings() compileFilesInDir("tests/init-global/pos", options, FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyBlacklisted)).checkCompile() } diff --git a/tests/init-global/warn/global-cycle1.check b/tests/init-global/warn/global-cycle1.check index 81859776b06f..adee7e47dd54 100644 --- a/tests/init-global/warn/global-cycle1.check +++ b/tests/init-global/warn/global-cycle1.check @@ -1,21 +1,20 @@ --- Warning: tests/init-global/neg/global-cycle1.scala:1:7 -------------------------------------------------------------- -1 |object A { +-- Warning: tests/init-global/warn/global-cycle1.scala:1:7 ------------------------------------------------------------- +1 |object A { // warn | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | ├── object A { [ global-cycle1.scala:1 ] + | ├── object A { // warn [ global-cycle1.scala:1 ] | │ ^ | ├── val a: Int = B.b [ global-cycle1.scala:2 ] | │ ^ | ├── object B { [ global-cycle1.scala:5 ] | │ ^ - | └── val b: Int = A.a [ global-cycle1.scala:6 ] + | └── val b: Int = A.a // warn [ global-cycle1.scala:6 ] | ^ --- Warning: tests/init-global/neg/global-cycle1.scala:6:17 ------------------------------------------------------------- -6 | val b: Int = A.a +-- Warning: tests/init-global/warn/global-cycle1.scala:6:17 ------------------------------------------------------------ +6 | val b: Int = A.a // warn | ^^^ | Access uninitialized field value a. Calling trace: | ├── object B { [ global-cycle1.scala:5 ] | │ ^ - | └── val b: Int = A.a [ global-cycle1.scala:6 ] + | └── val b: Int = A.a // warn [ global-cycle1.scala:6 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle1.scala b/tests/init-global/warn/global-cycle1.scala index 37c3c59f6926..e3951f155b76 100644 --- a/tests/init-global/warn/global-cycle1.scala +++ b/tests/init-global/warn/global-cycle1.scala @@ -1,11 +1,10 @@ -object A { +object A { // warn val a: Int = B.b } object B { - val b: Int = A.a + val b: Int = A.a // warn } @main def Test = print(A.a) - diff --git a/tests/init-global/warn/global-cycle14.check b/tests/init-global/warn/global-cycle14.check index d976653c05f0..ebdb4667f877 100644 --- a/tests/init-global/warn/global-cycle14.check +++ b/tests/init-global/warn/global-cycle14.check @@ -1,21 +1,20 @@ --- Warning: tests/init-global/neg/global-cycle14.scala:8:7 ------------------------------------------------------------- -8 |object A { +-- Warning: tests/init-global/warn/global-cycle14.scala:8:7 ------------------------------------------------------------ +8 |object A { // warn | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | ├── object A { [ global-cycle14.scala:8 ] + | ├── object A { // warn [ global-cycle14.scala:8 ] | │ ^ | ├── val n: Int = B.m [ global-cycle14.scala:9 ] | │ ^ | ├── object B { [ global-cycle14.scala:12 ] | │ ^ - | └── val m: Int = A.n [ global-cycle14.scala:13 ] + | └── val m: Int = A.n // warn [ global-cycle14.scala:13 ] | ^ --- Warning: tests/init-global/neg/global-cycle14.scala:13:17 ----------------------------------------------------------- -13 | val m: Int = A.n +-- Warning: tests/init-global/warn/global-cycle14.scala:13:17 ---------------------------------------------------------- +13 | val m: Int = A.n // warn | ^^^ | Access uninitialized field value n. Calling trace: | ├── object B { [ global-cycle14.scala:12 ] | │ ^ - | └── val m: Int = A.n [ global-cycle14.scala:13 ] + | └── val m: Int = A.n // warn [ global-cycle14.scala:13 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle14.scala b/tests/init-global/warn/global-cycle14.scala index 5028d70cf13c..696c7ba672f3 100644 --- a/tests/init-global/warn/global-cycle14.scala +++ b/tests/init-global/warn/global-cycle14.scala @@ -5,11 +5,10 @@ object O { val d = Data(3) } -object A { +object A { // warn val n: Int = B.m } object B { - val m: Int = A.n + val m: Int = A.n // warn } - diff --git a/tests/init-global/warn/global-cycle2.check b/tests/init-global/warn/global-cycle2.check index e01fb2f15aea..37c99b36ac25 100644 --- a/tests/init-global/warn/global-cycle2.check +++ b/tests/init-global/warn/global-cycle2.check @@ -1,11 +1,10 @@ --- Warning: tests/init-global/neg/global-cycle2.scala:6:21 ------------------------------------------------------------- -6 | def foo(): Int = A.a * 2 +-- Warning: tests/init-global/warn/global-cycle2.scala:6:21 ------------------------------------------------------------ +6 | def foo(): Int = A.a * 2 // warn | ^^^ | Access uninitialized field value a. Calling trace: | ├── object A { [ global-cycle2.scala:1 ] | │ ^ | ├── val a: Int = B.foo() [ global-cycle2.scala:2 ] | │ ^^^^^^^ - | └── def foo(): Int = A.a * 2 [ global-cycle2.scala:6 ] + | └── def foo(): Int = A.a * 2 // warn [ global-cycle2.scala:6 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle2.scala b/tests/init-global/warn/global-cycle2.scala index 396e257befd3..90ca855b00e8 100644 --- a/tests/init-global/warn/global-cycle2.scala +++ b/tests/init-global/warn/global-cycle2.scala @@ -3,6 +3,5 @@ object A { } object B { - def foo(): Int = A.a * 2 + def foo(): Int = A.a * 2 // warn } - diff --git a/tests/init-global/warn/global-cycle3.check b/tests/init-global/warn/global-cycle3.check index 1b3ccd8dd857..d250c3fda5e3 100644 --- a/tests/init-global/warn/global-cycle3.check +++ b/tests/init-global/warn/global-cycle3.check @@ -1,11 +1,10 @@ --- Warning: tests/init-global/neg/global-cycle3.scala:2:21 ------------------------------------------------------------- -2 | def foo(): Int = B.a + 10 +-- Warning: tests/init-global/warn/global-cycle3.scala:2:21 ------------------------------------------------------------ +2 | def foo(): Int = B.a + 10 // warn | ^^^ | Access uninitialized field value a. Calling trace: | ├── object B { [ global-cycle3.scala:5 ] | │ ^ | ├── val a: Int = A(4).foo() [ global-cycle3.scala:6 ] | │ ^^^^^^^^^^ - | └── def foo(): Int = B.a + 10 [ global-cycle3.scala:2 ] + | └── def foo(): Int = B.a + 10 // warn [ global-cycle3.scala:2 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle3.scala b/tests/init-global/warn/global-cycle3.scala index e37a15cb4e5b..9d72ac6321fb 100644 --- a/tests/init-global/warn/global-cycle3.scala +++ b/tests/init-global/warn/global-cycle3.scala @@ -1,8 +1,7 @@ class A(x: Int) { - def foo(): Int = B.a + 10 + def foo(): Int = B.a + 10 // warn } object B { val a: Int = A(4).foo() } - diff --git a/tests/init-global/warn/global-cycle4.check b/tests/init-global/warn/global-cycle4.check index 68a4dcae4b77..030f62782631 100644 --- a/tests/init-global/warn/global-cycle4.check +++ b/tests/init-global/warn/global-cycle4.check @@ -1,11 +1,10 @@ --- Warning: tests/init-global/neg/global-cycle4.scala:10:21 ------------------------------------------------------------ -10 | def foo(): Int = O.a + 10 +-- Warning: tests/init-global/warn/global-cycle4.scala:10:21 ----------------------------------------------------------- +10 | def foo(): Int = O.a + 10 // warn | ^^^ | Access uninitialized field value a. Calling trace: | ├── object O { [ global-cycle4.scala:17 ] | │ ^ | ├── val a: Int = D(5).bar().foo() [ global-cycle4.scala:18 ] | │ ^^^^^^^^^^^^^^^^ - | └── def foo(): Int = O.a + 10 [ global-cycle4.scala:10 ] + | └── def foo(): Int = O.a + 10 // warn [ global-cycle4.scala:10 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle4.scala b/tests/init-global/warn/global-cycle4.scala index d61bca1ad2e3..dea2a0b486cf 100644 --- a/tests/init-global/warn/global-cycle4.scala +++ b/tests/init-global/warn/global-cycle4.scala @@ -7,7 +7,7 @@ class B extends A { } class C extends A { - def foo(): Int = O.a + 10 + def foo(): Int = O.a + 10 // warn } class D(x: Int) { @@ -17,4 +17,3 @@ class D(x: Int) { object O { val a: Int = D(5).bar().foo() } - diff --git a/tests/init-global/warn/global-cycle5.check b/tests/init-global/warn/global-cycle5.check index c1d21cb77a45..072a80e4530f 100644 --- a/tests/init-global/warn/global-cycle5.check +++ b/tests/init-global/warn/global-cycle5.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/global-cycle5.scala:10:17 ------------------------------------------------------------ -10 | val b: Int = A.a.foo() +-- Warning: tests/init-global/warn/global-cycle5.scala:10:17 ----------------------------------------------------------- +10 | val b: Int = A.a.foo() // warn | ^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B { [ global-cycle5.scala:9 ] |│ ^ - |└── val b: Int = A.a.foo() [ global-cycle5.scala:10 ] + |└── val b: Int = A.a.foo() // warn [ global-cycle5.scala:10 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle5.scala b/tests/init-global/warn/global-cycle5.scala index c6eede89f901..7c3710cb815b 100644 --- a/tests/init-global/warn/global-cycle5.scala +++ b/tests/init-global/warn/global-cycle5.scala @@ -7,7 +7,7 @@ object A { } object B { - val b: Int = A.a.foo() + val b: Int = A.a.foo() // warn } class Y extends X { @@ -20,4 +20,4 @@ object C { def main = { A.a = new Y(); C -} +} \ No newline at end of file diff --git a/tests/init-global/warn/global-cycle6.check b/tests/init-global/warn/global-cycle6.check index 47a1c1543773..b6454a5d2cce 100644 --- a/tests/init-global/warn/global-cycle6.check +++ b/tests/init-global/warn/global-cycle6.check @@ -1,8 +1,8 @@ --- Warning: tests/init-global/neg/global-cycle6.scala:1:7 -------------------------------------------------------------- -1 |object A { +-- Warning: tests/init-global/warn/global-cycle6.scala:1:7 ------------------------------------------------------------- +1 |object A { // warn | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | ├── object A { [ global-cycle6.scala:1 ] + | ├── object A { // warn [ global-cycle6.scala:1 ] | │ ^ | ├── val n: Int = B.m [ global-cycle6.scala:2 ] | │ ^ @@ -12,10 +12,10 @@ | │ ^^^^^^^^^^^ | ├── class Inner { [ global-cycle6.scala:3 ] | │ ^ - | └── println(n) [ global-cycle6.scala:4 ] + | └── println(n) // warn [ global-cycle6.scala:4 ] | ^ --- Warning: tests/init-global/neg/global-cycle6.scala:4:12 ------------------------------------------------------------- -4 | println(n) +-- Warning: tests/init-global/warn/global-cycle6.scala:4:12 ------------------------------------------------------------ +4 | println(n) // warn | ^ | Access uninitialized field value n. Calling trace: | ├── object B { [ global-cycle6.scala:8 ] @@ -24,6 +24,5 @@ | │ ^^^^^^^^^^^ | ├── class Inner { [ global-cycle6.scala:3 ] | │ ^ - | └── println(n) [ global-cycle6.scala:4 ] + | └── println(n) // warn [ global-cycle6.scala:4 ] | ^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle6.scala b/tests/init-global/warn/global-cycle6.scala index 216628fe6b38..030e08d37117 100644 --- a/tests/init-global/warn/global-cycle6.scala +++ b/tests/init-global/warn/global-cycle6.scala @@ -1,7 +1,7 @@ -object A { +object A { // warn val n: Int = B.m class Inner { - println(n) + println(n) // warn } } @@ -22,4 +22,4 @@ object O { val a = new A.Inner val m: Int = 10 } -} +} \ No newline at end of file diff --git a/tests/init-global/warn/global-cycle7.check b/tests/init-global/warn/global-cycle7.check index 96a63b77b73e..366857885769 100644 --- a/tests/init-global/warn/global-cycle7.check +++ b/tests/init-global/warn/global-cycle7.check @@ -1,21 +1,20 @@ --- Warning: tests/init-global/neg/global-cycle7.scala:1:7 -------------------------------------------------------------- -1 |object A { +-- Warning: tests/init-global/warn/global-cycle7.scala:1:7 ------------------------------------------------------------- +1 |object A { // warn | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | ├── object A { [ global-cycle7.scala:1 ] + | ├── object A { // warn [ global-cycle7.scala:1 ] | │ ^ | ├── val n: Int = B.m [ global-cycle7.scala:2 ] | │ ^ | ├── object B { [ global-cycle7.scala:5 ] | │ ^ - | └── val m: Int = A.n [ global-cycle7.scala:6 ] + | └── val m: Int = A.n // warn [ global-cycle7.scala:6 ] | ^ --- Warning: tests/init-global/neg/global-cycle7.scala:6:17 ------------------------------------------------------------- -6 | val m: Int = A.n +-- Warning: tests/init-global/warn/global-cycle7.scala:6:17 ------------------------------------------------------------ +6 | val m: Int = A.n // warn | ^^^ | Access uninitialized field value n. Calling trace: | ├── object B { [ global-cycle7.scala:5 ] | │ ^ - | └── val m: Int = A.n [ global-cycle7.scala:6 ] + | └── val m: Int = A.n // warn [ global-cycle7.scala:6 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle7.scala b/tests/init-global/warn/global-cycle7.scala index bffe6e0ff564..30b74ceb95c4 100644 --- a/tests/init-global/warn/global-cycle7.scala +++ b/tests/init-global/warn/global-cycle7.scala @@ -1,9 +1,9 @@ -object A { +object A { // warn val n: Int = B.m } object B { - val m: Int = A.n + val m: Int = A.n // warn } abstract class TokensCommon { @@ -16,4 +16,3 @@ object JavaTokens extends TokensCommon { final def maxToken: Int = DOUBLE final val DOUBLE = 188 } - diff --git a/tests/init-global/warn/global-cycle8.check b/tests/init-global/warn/global-cycle8.check index 6dc544fe8e7c..93c9699c653e 100644 --- a/tests/init-global/warn/global-cycle8.check +++ b/tests/init-global/warn/global-cycle8.check @@ -1,8 +1,8 @@ --- Warning: tests/init-global/neg/global-cycle8.scala:9:7 -------------------------------------------------------------- -9 |object O { +-- Warning: tests/init-global/warn/global-cycle8.scala:9:7 ------------------------------------------------------------- +9 |object O { // warn | ^ | Cyclic initialization: object O -> object P -> object O. Calling trace: - | ├── object O { [ global-cycle8.scala:9 ] + | ├── object O { // warn [ global-cycle8.scala:9 ] | │ ^ | ├── println(P.m) [ global-cycle8.scala:11 ] | │ ^ @@ -14,4 +14,3 @@ | │ ^^^^^^^^^ | └── def foo() = println(O.n) [ global-cycle8.scala:2 ] | ^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-cycle8.scala b/tests/init-global/warn/global-cycle8.scala index 6b3c4b9fffc6..de4e6620585d 100644 --- a/tests/init-global/warn/global-cycle8.scala +++ b/tests/init-global/warn/global-cycle8.scala @@ -6,7 +6,7 @@ class B { val a = new A } -object O { +object O { // warn val n: Int = 10 println(P.m) } @@ -18,4 +18,3 @@ object P { object Q { def bar(b: B) = b.a.foo() } - diff --git a/tests/init-global/warn/global-irrelevance1.check b/tests/init-global/warn/global-irrelevance1.check index 799d80ec9623..447ba6b6b29a 100644 --- a/tests/init-global/warn/global-irrelevance1.check +++ b/tests/init-global/warn/global-irrelevance1.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/global-irrelevance1.scala:5:12 ------------------------------------------------------- -5 | var y = A.x * 2 +-- Warning: tests/init-global/warn/global-irrelevance1.scala:5:12 ------------------------------------------------------ +5 | var y = A.x * 2 // warn | ^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ global-irrelevance1.scala:4 ] |│ ^ - |└── var y = A.x * 2 [ global-irrelevance1.scala:5 ] + |└── var y = A.x * 2 // warn [ global-irrelevance1.scala:5 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-irrelevance1.scala b/tests/init-global/warn/global-irrelevance1.scala index 5cc6f8f39049..d19099f287ba 100644 --- a/tests/init-global/warn/global-irrelevance1.scala +++ b/tests/init-global/warn/global-irrelevance1.scala @@ -2,4 +2,4 @@ object A: var x = 6 object B: - var y = A.x * 2 + var y = A.x * 2 // warn \ No newline at end of file diff --git a/tests/init-global/warn/global-irrelevance2.check b/tests/init-global/warn/global-irrelevance2.check index 56263b936308..156b34fa6aa5 100644 --- a/tests/init-global/warn/global-irrelevance2.check +++ b/tests/init-global/warn/global-irrelevance2.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/global-irrelevance2.scala:5:6 -------------------------------------------------------- -5 | A.x = b * 2 +-- Warning: tests/init-global/warn/global-irrelevance2.scala:5:6 ------------------------------------------------------- +5 | A.x = b * 2 // warn | ^^^^^^^^^^^^ | Mutating object A during initialization of object B. | Mutating other static objects during the initialization of one static object is forbidden. Calling trace: @@ -9,6 +9,5 @@ | │ ^^^^^^^^^ | ├── class B(b: Int): [ global-irrelevance2.scala:4 ] | │ ^ - | └── A.x = b * 2 [ global-irrelevance2.scala:5 ] + | └── A.x = b * 2 // warn [ global-irrelevance2.scala:5 ] | ^^^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-irrelevance2.scala b/tests/init-global/warn/global-irrelevance2.scala index ad1f2e1b4fb4..9bf7acab4343 100644 --- a/tests/init-global/warn/global-irrelevance2.scala +++ b/tests/init-global/warn/global-irrelevance2.scala @@ -2,8 +2,7 @@ object A: var x = 6 class B(b: Int): - A.x = b * 2 + A.x = b * 2 // warn object B: new B(10) - diff --git a/tests/init-global/warn/global-irrelevance3.check b/tests/init-global/warn/global-irrelevance3.check index 7d7f9dbfb1fc..dba945224f97 100644 --- a/tests/init-global/warn/global-irrelevance3.check +++ b/tests/init-global/warn/global-irrelevance3.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/global-irrelevance3.scala:9:13 ------------------------------------------------------- -9 | (() => x) +-- Warning: tests/init-global/warn/global-irrelevance3.scala:9:13 ------------------------------------------------------ +9 | (() => x) // warn | ^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: @@ -7,6 +7,5 @@ |│ ^ |├── var y = A.p.g() [ global-irrelevance3.scala:14 ] |│ ^^^^^^^ - |└── (() => x) [ global-irrelevance3.scala:9 ] + |└── (() => x) // warn [ global-irrelevance3.scala:9 ] | ^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-irrelevance3.scala b/tests/init-global/warn/global-irrelevance3.scala index 7c2c42fe0490..f8db31f14a72 100644 --- a/tests/init-global/warn/global-irrelevance3.scala +++ b/tests/init-global/warn/global-irrelevance3.scala @@ -6,10 +6,9 @@ object A: var x = 6 new Pair( y => x = y, - (() => x) + (() => x) // warn ) object B: var y = A.p.g() - diff --git a/tests/init-global/warn/global-irrelevance4.check b/tests/init-global/warn/global-irrelevance4.check index ebabde96294d..7253e5b39688 100644 --- a/tests/init-global/warn/global-irrelevance4.check +++ b/tests/init-global/warn/global-irrelevance4.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/global-irrelevance4.scala:8:9 -------------------------------------------------------- -8 | (y => x = y), +-- Warning: tests/init-global/warn/global-irrelevance4.scala:8:9 ------------------------------------------------------- +8 | (y => x = y), // warn | ^^^^^^^^^^ | Mutating object A during initialization of object B. | Mutating other static objects during the initialization of one static object is forbidden. Calling trace: @@ -7,6 +7,5 @@ | │ ^ | ├── A.p.f(10) [ global-irrelevance4.scala:13 ] | │ ^^^^^^^^^ - | └── (y => x = y), [ global-irrelevance4.scala:8 ] + | └── (y => x = y), // warn [ global-irrelevance4.scala:8 ] | ^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-irrelevance4.scala b/tests/init-global/warn/global-irrelevance4.scala index 00bd77a63393..4ddf3d78e4ae 100644 --- a/tests/init-global/warn/global-irrelevance4.scala +++ b/tests/init-global/warn/global-irrelevance4.scala @@ -5,10 +5,9 @@ object A: def foo(): Pair = var x = 6 new Pair( - (y => x = y), + (y => x = y), // warn () => x ) object B: A.p.f(10) - diff --git a/tests/init-global/warn/global-irrelevance5.check b/tests/init-global/warn/global-irrelevance5.check index 7d472621821c..c3581e0b9bbc 100644 --- a/tests/init-global/warn/global-irrelevance5.check +++ b/tests/init-global/warn/global-irrelevance5.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/global-irrelevance5.scala:6:17 ------------------------------------------------------- -6 | var y = A.array(0) * 2 +-- Warning: tests/init-global/warn/global-irrelevance5.scala:6:17 ------------------------------------------------------ +6 | var y = A.array(0) * 2 // warn | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ global-irrelevance5.scala:5 ] |│ ^ - |└── var y = A.array(0) * 2 [ global-irrelevance5.scala:6 ] + |└── var y = A.array(0) * 2 // warn [ global-irrelevance5.scala:6 ] | ^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-irrelevance5.scala b/tests/init-global/warn/global-irrelevance5.scala index e47548ce2088..f557157ded21 100644 --- a/tests/init-global/warn/global-irrelevance5.scala +++ b/tests/init-global/warn/global-irrelevance5.scala @@ -3,5 +3,4 @@ object A: array(0) = 10 object B: - var y = A.array(0) * 2 - + var y = A.array(0) * 2 // warn diff --git a/tests/init-global/warn/global-irrelevance6.check b/tests/init-global/warn/global-irrelevance6.check index 52df6bd253e2..3e447a915ba3 100644 --- a/tests/init-global/warn/global-irrelevance6.check +++ b/tests/init-global/warn/global-irrelevance6.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/global-irrelevance6.scala:9:17 ------------------------------------------------------- -9 | var y = A.array(0).foo() * 2 +-- Warning: tests/init-global/warn/global-irrelevance6.scala:9:17 ------------------------------------------------------ +9 | var y = A.array(0).foo() * 2 // warn | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ global-irrelevance6.scala:8 ] |│ ^ - |└── var y = A.array(0).foo() * 2 [ global-irrelevance6.scala:9 ] + |└── var y = A.array(0).foo() * 2 // warn [ global-irrelevance6.scala:9 ] | ^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-irrelevance6.scala b/tests/init-global/warn/global-irrelevance6.scala index a2727cf1d0b9..43983f05ffac 100644 --- a/tests/init-global/warn/global-irrelevance6.scala +++ b/tests/init-global/warn/global-irrelevance6.scala @@ -6,5 +6,4 @@ object A: val n = array(0).foo() // ok, no crash object B: - var y = A.array(0).foo() * 2 - + var y = A.array(0).foo() * 2 // warn diff --git a/tests/init-global/warn/global-irrelevance7.check b/tests/init-global/warn/global-irrelevance7.check index 3178c21cbca5..c5f0da1a204b 100644 --- a/tests/init-global/warn/global-irrelevance7.check +++ b/tests/init-global/warn/global-irrelevance7.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/global-irrelevance7.scala:10:17 ------------------------------------------------------ -10 | var y = A.array(0).foo() * 2 +-- Warning: tests/init-global/warn/global-irrelevance7.scala:10:17 ----------------------------------------------------- +10 | var y = A.array(0).foo() * 2 // warn | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ global-irrelevance7.scala:9 ] |│ ^ - |└── var y = A.array(0).foo() * 2 [ global-irrelevance7.scala:10 ] + |└── var y = A.array(0).foo() * 2 // warn [ global-irrelevance7.scala:10 ] | ^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-irrelevance7.scala b/tests/init-global/warn/global-irrelevance7.scala index e55f646cbc39..5f92dde9a3f9 100644 --- a/tests/init-global/warn/global-irrelevance7.scala +++ b/tests/init-global/warn/global-irrelevance7.scala @@ -7,5 +7,4 @@ object A: val n = array(0).foo() // ok object B: - var y = A.array(0).foo() * 2 - + var y = A.array(0).foo() * 2 // warn diff --git a/tests/init-global/warn/global-list.check b/tests/init-global/warn/global-list.check index 4d4bc3d7e8ca..f8a57918e411 100644 --- a/tests/init-global/warn/global-list.check +++ b/tests/init-global/warn/global-list.check @@ -1,37 +1,36 @@ --- Warning: tests/init-global/neg/global-list.scala:3:7 ---------------------------------------------------------------- -3 |object O: +-- Warning: tests/init-global/warn/global-list.scala:3:7 --------------------------------------------------------------- +3 |object O: // warn | ^ | Cyclic initialization: object O -> object Foo -> object O. Calling trace: - | ├── object O: [ global-list.scala:3 ] + | ├── object O: // warn [ global-list.scala:3 ] | │ ^ | ├── val a = Foo("Apple") [ global-list.scala:4 ] | │ ^^^ | ├── object Foo: [ global-list.scala:8 ] | │ ^ - | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | └── val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn [ global-list.scala:9 ] | ^ --- Warning: tests/init-global/neg/global-list.scala:9:30 --------------------------------------------------------------- -9 | val all: List[Foo] = List(O.a, O.b, O.c) +-- Warning: tests/init-global/warn/global-list.scala:9:30 -------------------------------------------------------------- +9 | val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn | ^^^ - | Access uninitialized field value a. Calling trace: - | ├── object Foo: [ global-list.scala:8 ] - | │ ^ - | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] - | ^^^ --- Warning: tests/init-global/neg/global-list.scala:9:35 --------------------------------------------------------------- -9 | val all: List[Foo] = List(O.a, O.b, O.c) + | Access uninitialized field value a. Calling trace: + | ├── object Foo: [ global-list.scala:8 ] + | │ ^ + | └── val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn [ global-list.scala:9 ] + | ^^^ +-- Warning: tests/init-global/warn/global-list.scala:9:35 -------------------------------------------------------------- +9 | val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn | ^^^ - | Access uninitialized field value b. Calling trace: - | ├── object Foo: [ global-list.scala:8 ] - | │ ^ - | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] - | ^^^ --- Warning: tests/init-global/neg/global-list.scala:9:40 --------------------------------------------------------------- -9 | val all: List[Foo] = List(O.a, O.b, O.c) + | Access uninitialized field value b. Calling trace: + | ├── object Foo: [ global-list.scala:8 ] + | │ ^ + | └── val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn [ global-list.scala:9 ] + | ^^^ +-- Warning: tests/init-global/warn/global-list.scala:9:40 -------------------------------------------------------------- +9 | val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn | ^^^ - | Access uninitialized field value c. Calling trace: - | ├── object Foo: [ global-list.scala:8 ] - | │ ^ - | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] - | ^^^ -No warnings can be incurred under -Werror. + | Access uninitialized field value c. Calling trace: + | ├── object Foo: [ global-list.scala:8 ] + | │ ^ + | └── val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn [ global-list.scala:9 ] + | ^^^ diff --git a/tests/init-global/warn/global-list.scala b/tests/init-global/warn/global-list.scala index eb8fad77372b..8202d03584a9 100644 --- a/tests/init-global/warn/global-list.scala +++ b/tests/init-global/warn/global-list.scala @@ -1,9 +1,9 @@ case class Foo(name: String) -object O: +object O: // warn val a = Foo("Apple") val b = Foo("Banana") val c = Foo("Cherry") object Foo: - val all: List[Foo] = List(O.a, O.b, O.c) + val all: List[Foo] = List(O.a, O.b, O.c) // warn // warn // warn \ No newline at end of file diff --git a/tests/init-global/warn/global-local-var.check b/tests/init-global/warn/global-local-var.check index bbedc06dce3d..028ad87e6716 100644 --- a/tests/init-global/warn/global-local-var.check +++ b/tests/init-global/warn/global-local-var.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/global-local-var.scala:10:6 ---------------------------------------------------------- -10 | B.a + 10 + sum +-- Warning: tests/init-global/warn/global-local-var.scala:10:6 --------------------------------------------------------- +10 | B.a + 10 + sum // warn | ^^^ | Access uninitialized field value a. Calling trace: | ├── object B { [ global-local-var.scala:14 ] @@ -8,6 +8,5 @@ | │ ^^^^^^^^^^ | ├── def foo(): Int = { [ global-local-var.scala:2 ] | │ ^ - | └── B.a + 10 + sum [ global-local-var.scala:10 ] + | └── B.a + 10 + sum // warn [ global-local-var.scala:10 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/global-local-var.scala b/tests/init-global/warn/global-local-var.scala index c9c2d07e615e..384694d7aa15 100644 --- a/tests/init-global/warn/global-local-var.scala +++ b/tests/init-global/warn/global-local-var.scala @@ -7,11 +7,10 @@ class A(x: Int) { sum += i i += 1 - B.a + 10 + sum + B.a + 10 + sum // warn } } object B { val a: Int = A(4).foo() } - diff --git a/tests/init-global/warn/global-region1.check b/tests/init-global/warn/global-region1.check index b3b7e2a3b7ca..342de87cfa05 100644 --- a/tests/init-global/warn/global-region1.check +++ b/tests/init-global/warn/global-region1.check @@ -1,11 +1,10 @@ --- Warning: tests/init-global/neg/global-region1.scala:3:51 ------------------------------------------------------------ -3 |class D(var y: Int) extends B { def foo(): Int = A.m } +-- Warning: tests/init-global/warn/global-region1.scala:3:51 ----------------------------------------------------------- +3 |class D(var y: Int) extends B { def foo(): Int = A.m } // warn | ^^^ - | Access uninitialized field value m. Calling trace: - | ├── object A: [ global-region1.scala:6 ] - | │ ^ - | ├── val m: Int = box1.value.foo() [ global-region1.scala:9 ] - | │ ^^^^^^^^^^^^^^^^ - | └── class D(var y: Int) extends B { def foo(): Int = A.m } [ global-region1.scala:3 ] - | ^^^ -No warnings can be incurred under -Werror. + | Access uninitialized field value m. Calling trace: + | ├── object A: [ global-region1.scala:6 ] + | │ ^ + | ├── val m: Int = box1.value.foo() [ global-region1.scala:9 ] + | │ ^^^^^^^^^^^^^^^^ + | └── class D(var y: Int) extends B { def foo(): Int = A.m } // warn [ global-region1.scala:3 ] + | ^^^ diff --git a/tests/init-global/warn/global-region1.scala b/tests/init-global/warn/global-region1.scala index 611c2bea553c..91789507a373 100644 --- a/tests/init-global/warn/global-region1.scala +++ b/tests/init-global/warn/global-region1.scala @@ -1,10 +1,9 @@ trait B { def foo(): Int } class C(var x: Int) extends B { def foo(): Int = 20 } -class D(var y: Int) extends B { def foo(): Int = A.m } +class D(var y: Int) extends B { def foo(): Int = A.m } // warn class Box(var value: B) object A: val box1: Box = new Box(new C(5)) val box2: Box = new Box(new D(10)) val m: Int = box1.value.foo() - diff --git a/tests/init-global/warn/i11262.check b/tests/init-global/warn/i11262.check index 643a70838167..ac80445e9886 100644 --- a/tests/init-global/warn/i11262.check +++ b/tests/init-global/warn/i11262.check @@ -1,15 +1,14 @@ --- Warning: tests/init-global/neg/i11262.scala:1:7 --------------------------------------------------------------------- -1 |object A { val x: String = B.y } +-- Warning: tests/init-global/warn/i11262.scala:1:7 -------------------------------------------------------------------- +1 |object A { val x: String = B.y } // warn | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | ├── object A { val x: String = B.y } [ i11262.scala:1 ] + | ├── object A { val x: String = B.y } // warn [ i11262.scala:1 ] | │ ^ - | └── object B { val y: String = A.x } [ i11262.scala:2 ] + | └── object B { val y: String = A.x } // warn [ i11262.scala:2 ] | ^ --- Warning: tests/init-global/neg/i11262.scala:2:29 -------------------------------------------------------------------- -2 |object B { val y: String = A.x } +-- Warning: tests/init-global/warn/i11262.scala:2:29 ------------------------------------------------------------------- +2 |object B { val y: String = A.x } // warn | ^^^ | Access uninitialized field value x. Calling trace: - | └── object B { val y: String = A.x } [ i11262.scala:2 ] + | └── object B { val y: String = A.x } // warn [ i11262.scala:2 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/i11262.scala b/tests/init-global/warn/i11262.scala index 78e779e00efc..896e4db4a0ed 100644 --- a/tests/init-global/warn/i11262.scala +++ b/tests/init-global/warn/i11262.scala @@ -1,3 +1,2 @@ -object A { val x: String = B.y } -object B { val y: String = A.x } - +object A { val x: String = B.y } // warn +object B { val y: String = A.x } // warn diff --git a/tests/init-global/warn/i12544b.check b/tests/init-global/warn/i12544b.check index 7680b62d0b7b..9f97ea36f7fa 100644 --- a/tests/init-global/warn/i12544b.check +++ b/tests/init-global/warn/i12544b.check @@ -1,21 +1,20 @@ --- Warning: tests/init-global/neg/i12544b.scala:5:9 -------------------------------------------------------------------- -5 | object nested: +-- Warning: tests/init-global/warn/i12544b.scala:5:9 ------------------------------------------------------------------- +5 | object nested: // warn | ^ | Cyclic initialization: object nested -> object Enum -> object nested. Calling trace: - | ├── object nested: [ i12544b.scala:5 ] + | ├── object nested: // warn [ i12544b.scala:5 ] | │ ^ | ├── val a: Enum = Case [ i12544b.scala:6 ] | │ ^^^^ | ├── object Enum: [ i12544b.scala:4 ] | │ ^ - | └── val b: Enum = f(nested.a) [ i12544b.scala:8 ] + | └── val b: Enum = f(nested.a) // warn [ i12544b.scala:8 ] | ^^^^^^ --- Warning: tests/init-global/neg/i12544b.scala:8:25 ------------------------------------------------------------------- -8 | val b: Enum = f(nested.a) +-- Warning: tests/init-global/warn/i12544b.scala:8:25 ------------------------------------------------------------------ +8 | val b: Enum = f(nested.a) // warn | ^^^^^^^^ | Access uninitialized field value a. Calling trace: | ├── object Enum: [ i12544b.scala:4 ] | │ ^ - | └── val b: Enum = f(nested.a) [ i12544b.scala:8 ] + | └── val b: Enum = f(nested.a) // warn [ i12544b.scala:8 ] | ^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/i12544b.scala b/tests/init-global/warn/i12544b.scala index 886d1619fc10..e79e9b400353 100644 --- a/tests/init-global/warn/i12544b.scala +++ b/tests/init-global/warn/i12544b.scala @@ -2,12 +2,11 @@ enum Enum: case Case object Enum: - object nested: + object nested: // warn val a: Enum = Case - val b: Enum = f(nested.a) + val b: Enum = f(nested.a) // warn def f(e: Enum): Enum = e @main def main(): Unit = println(Enum.b) - diff --git a/tests/init-global/warn/i9176.check b/tests/init-global/warn/i9176.check index a26b66081d75..05a208d1f8a1 100644 --- a/tests/init-global/warn/i9176.check +++ b/tests/init-global/warn/i9176.check @@ -1,9 +1,8 @@ --- Warning: tests/init-global/neg/i9176.scala:2:12 --------------------------------------------------------------------- -2 |case object A extends Foo(B) +-- Warning: tests/init-global/warn/i9176.scala:2:12 -------------------------------------------------------------------- +2 |case object A extends Foo(B) // warn | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | ├── case object A extends Foo(B) [ i9176.scala:2 ] + | ├── case object A extends Foo(B) // warn [ i9176.scala:2 ] | │ ^ | └── case object B extends Foo(A) [ i9176.scala:3 ] | ^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/i9176.scala b/tests/init-global/warn/i9176.scala index 82776d85fcd9..86b65f6d8c0f 100644 --- a/tests/init-global/warn/i9176.scala +++ b/tests/init-global/warn/i9176.scala @@ -1,5 +1,5 @@ class Foo(val opposite: Foo) -case object A extends Foo(B) +case object A extends Foo(B) // warn case object B extends Foo(A) object Test { def main(args: Array[String]): Unit = { @@ -7,4 +7,3 @@ object Test { println(B.opposite) } } - diff --git a/tests/init-global/warn/line-spacing.check b/tests/init-global/warn/line-spacing.check index 66f695d62ca5..c38f89ddc69e 100644 --- a/tests/init-global/warn/line-spacing.check +++ b/tests/init-global/warn/line-spacing.check @@ -1,6 +1,6 @@ --- Warning: tests/init-global/neg/line-spacing.scala:4:7 --------------------------------------------------------------- +-- Warning: tests/init-global/warn/line-spacing.scala:4:7 -------------------------------------------------------------- 3 | B -4 | .s.length +4 | .s.length // warn | ^ | Access uninitialized field value s. Calling trace: | ├── object B { [ line-spacing.scala:7 ] @@ -9,6 +9,5 @@ | │ ^^^ | ├── def a: Int = [ line-spacing.scala:2 ] | │ ^ - | └── .s.length [ line-spacing.scala:4 ] + | └── .s.length // warn [ line-spacing.scala:4 ] | ^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/line-spacing.scala b/tests/init-global/warn/line-spacing.scala index 334425bbc9a8..cfea71b2ee59 100644 --- a/tests/init-global/warn/line-spacing.scala +++ b/tests/init-global/warn/line-spacing.scala @@ -1,10 +1,9 @@ object A { def a: Int = B - .s.length + .s.length // warn } object B { val s: String = s"${A.a}a" } - diff --git a/tests/init-global/warn/mutable-array.check b/tests/init-global/warn/mutable-array.check index 9a877be4eff4..fb96b33c85a9 100644 --- a/tests/init-global/warn/mutable-array.check +++ b/tests/init-global/warn/mutable-array.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/mutable-array.scala:8:19 ------------------------------------------------------------- -8 | val x: Int = box.value +-- Warning: tests/init-global/warn/mutable-array.scala:8:19 ------------------------------------------------------------ +8 | val x: Int = box.value // warn | ^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ mutable-array.scala:5 ] |│ ^ - |└── val x: Int = box.value [ mutable-array.scala:8 ] + |└── val x: Int = box.value // warn [ mutable-array.scala:8 ] | ^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-array.scala b/tests/init-global/warn/mutable-array.scala index 7b26656b5acb..a0ea2ea0f465 100644 --- a/tests/init-global/warn/mutable-array.scala +++ b/tests/init-global/warn/mutable-array.scala @@ -5,5 +5,4 @@ object A: object B: val boxes: Array[A.Box] = Array(A.box) val box: A.Box = boxes(0) - val x: Int = box.value - + val x: Int = box.value // warn diff --git a/tests/init-global/warn/mutable-read1.check b/tests/init-global/warn/mutable-read1.check index 4e446490d7e5..e141ced0c70d 100644 --- a/tests/init-global/warn/mutable-read1.check +++ b/tests/init-global/warn/mutable-read1.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/mutable-read1.scala:10:20 ------------------------------------------------------------ -10 | val n: Int = boxA.value +-- Warning: tests/init-global/warn/mutable-read1.scala:10:20 ----------------------------------------------------------- +10 | val n: Int = boxA.value // warn | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ mutable-read1.scala:6 ] |│ ^ - |└── val n: Int = boxA.value [ mutable-read1.scala:10 ] + |└── val n: Int = boxA.value // warn [ mutable-read1.scala:10 ] | ^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read1.scala b/tests/init-global/warn/mutable-read1.scala index 1fb3e8935c59..82bcfb3918c7 100644 --- a/tests/init-global/warn/mutable-read1.scala +++ b/tests/init-global/warn/mutable-read1.scala @@ -7,4 +7,4 @@ object B: val boxB: Box = new Box(5) val boxA: Box = A.box val m: Int = boxB.value - val n: Int = boxA.value + val n: Int = boxA.value // warn \ No newline at end of file diff --git a/tests/init-global/warn/mutable-read2.check b/tests/init-global/warn/mutable-read2.check index 24c3c0ef3789..906a82ec09a5 100644 --- a/tests/init-global/warn/mutable-read2.check +++ b/tests/init-global/warn/mutable-read2.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/mutable-read2.scala:10:19 ------------------------------------------------------------ -10 | val b: Int = box.value +-- Warning: tests/init-global/warn/mutable-read2.scala:10:19 ----------------------------------------------------------- +10 | val b: Int = box.value // warn | ^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ mutable-read2.scala:7 ] |│ ^ - |└── val b: Int = box.value [ mutable-read2.scala:10 ] + |└── val b: Int = box.value // warn [ mutable-read2.scala:10 ] | ^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read2.scala b/tests/init-global/warn/mutable-read2.scala index d982d78e153e..3337bd3e30bb 100644 --- a/tests/init-global/warn/mutable-read2.scala +++ b/tests/init-global/warn/mutable-read2.scala @@ -7,4 +7,4 @@ object A: object B: val box: A.Box = A.box val a: Int = box.initial - val b: Int = box.value + val b: Int = box.value // warn \ No newline at end of file diff --git a/tests/init-global/warn/mutable-read3.check b/tests/init-global/warn/mutable-read3.check index e0eeb62cee63..754196794a1f 100644 --- a/tests/init-global/warn/mutable-read3.check +++ b/tests/init-global/warn/mutable-read3.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/mutable-read3.scala:9:19 ------------------------------------------------------------- -9 | val x: Int = box.value +-- Warning: tests/init-global/warn/mutable-read3.scala:9:19 ------------------------------------------------------------ +9 | val x: Int = box.value // warn | ^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ mutable-read3.scala:5 ] |│ ^ - |└── val x: Int = box.value [ mutable-read3.scala:9 ] + |└── val x: Int = box.value // warn [ mutable-read3.scala:9 ] | ^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read3.scala b/tests/init-global/warn/mutable-read3.scala index 057cfe6f25b9..7f0cbb3664c0 100644 --- a/tests/init-global/warn/mutable-read3.scala +++ b/tests/init-global/warn/mutable-read3.scala @@ -6,4 +6,4 @@ object B: val boxes: Array[A.Box] = new Array(1) boxes(0) = A.box val box: A.Box = boxes(0) - val x: Int = box.value + val x: Int = box.value // warn \ No newline at end of file diff --git a/tests/init-global/warn/mutable-read4.check b/tests/init-global/warn/mutable-read4.check index 81f3a68e0f8b..0ccb8e61549d 100644 --- a/tests/init-global/warn/mutable-read4.check +++ b/tests/init-global/warn/mutable-read4.check @@ -1,10 +1,9 @@ --- Warning: tests/init-global/neg/mutable-read4.scala:10:20 ------------------------------------------------------------ -10 | val n: Int = boxA.value +-- Warning: tests/init-global/warn/mutable-read4.scala:10:20 ----------------------------------------------------------- +10 | val n: Int = boxA.value // warn | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: |├── object B: [ mutable-read4.scala:6 ] |│ ^ - |└── val n: Int = boxA.value [ mutable-read4.scala:10 ] + |└── val n: Int = boxA.value // warn [ mutable-read4.scala:10 ] | ^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read4.scala b/tests/init-global/warn/mutable-read4.scala index 1fb3e8935c59..82bcfb3918c7 100644 --- a/tests/init-global/warn/mutable-read4.scala +++ b/tests/init-global/warn/mutable-read4.scala @@ -7,4 +7,4 @@ object B: val boxB: Box = new Box(5) val boxA: Box = A.box val m: Int = boxB.value - val n: Int = boxA.value + val n: Int = boxA.value // warn \ No newline at end of file diff --git a/tests/init-global/warn/mutable-read5.check b/tests/init-global/warn/mutable-read5.check index 0fa788588d97..ffbf1c71fc2c 100644 --- a/tests/init-global/warn/mutable-read5.check +++ b/tests/init-global/warn/mutable-read5.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/mutable-read5.scala:4:38 ------------------------------------------------------------- -4 | def name(s: String): Name = Name(0, chrs.length) +-- Warning: tests/init-global/warn/mutable-read5.scala:4:38 ------------------------------------------------------------ +4 | def name(s: String): Name = Name(0, chrs.length) // warn | ^^^^ |Reading mutable state of object Names during initialization of object StdNames. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: @@ -7,6 +7,5 @@ |│ ^ |├── val AnyRef: Names.Name = Names.name("AnyRef") [ mutable-read5.scala:7 ] |│ ^^^^^^^^^^^^^^^^^^^^ - |└── def name(s: String): Name = Name(0, chrs.length) [ mutable-read5.scala:4 ] + |└── def name(s: String): Name = Name(0, chrs.length) // warn [ mutable-read5.scala:4 ] | ^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read5.scala b/tests/init-global/warn/mutable-read5.scala index c48eeff365c4..10977cc9cc5c 100644 --- a/tests/init-global/warn/mutable-read5.scala +++ b/tests/init-global/warn/mutable-read5.scala @@ -1,9 +1,9 @@ object Names: class Name(val start: Int, val length: Int) var chrs: Array[Char] = new Array[Char](0x20000) - def name(s: String): Name = Name(0, chrs.length) + def name(s: String): Name = Name(0, chrs.length) // warn object StdNames: val AnyRef: Names.Name = Names.name("AnyRef") val Array: Names.Name = Names.name("Array") - val List: Names.Name = Names.name("List") + val List: Names.Name = Names.name("List") \ No newline at end of file diff --git a/tests/init-global/warn/mutable-read6.check b/tests/init-global/warn/mutable-read6.check index a43e62bafae0..92d2f58c3ecc 100644 --- a/tests/init-global/warn/mutable-read6.check +++ b/tests/init-global/warn/mutable-read6.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/mutable-read6.scala:7:35 ------------------------------------------------------------- -7 | final def source: SourceFile = _source +-- Warning: tests/init-global/warn/mutable-read6.scala:7:35 ------------------------------------------------------------ +7 | final def source: SourceFile = _source // warn | ^^^^^^^ |Reading mutable state of object Contexts during initialization of object Implicits. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: @@ -7,6 +7,5 @@ |│ ^ |├── val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) [ mutable-read6.scala:15 ] |│ ^^^^^^^^^^^^^^^^ - |└── final def source: SourceFile = _source [ mutable-read6.scala:7 ] + |└── final def source: SourceFile = _source // warn [ mutable-read6.scala:7 ] | ^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read6.scala b/tests/init-global/warn/mutable-read6.scala index 1b706a576060..013f7c998221 100644 --- a/tests/init-global/warn/mutable-read6.scala +++ b/tests/init-global/warn/mutable-read6.scala @@ -4,7 +4,7 @@ object Contexts: val NoContext: Context = new Context class Context: private var _source: SourceFile = null - final def source: SourceFile = _source + final def source: SourceFile = _source // warn def setSource(source: SourceFile) = { this._source = source } @@ -12,4 +12,4 @@ object Contexts: object Implicits: import Contexts.* case class SearchFailure(tag: Int, source: SourceFile) - val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) + val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) \ No newline at end of file diff --git a/tests/init-global/warn/mutable-read7.check b/tests/init-global/warn/mutable-read7.check index 5198721ebf40..244ed1519cdf 100644 --- a/tests/init-global/warn/mutable-read7.check +++ b/tests/init-global/warn/mutable-read7.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/mutable-read7.scala:7:17 ------------------------------------------------------------- -7 | if (Positioned.debug) { +-- Warning: tests/init-global/warn/mutable-read7.scala:7:17 ------------------------------------------------------------ +7 | if (Positioned.debug) { // warn | ^^^^^^^^^^^^^^^^ |Reading mutable state of object Positioned during initialization of object Trees. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: @@ -11,6 +11,5 @@ |│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |├── abstract class Positioned: [ mutable-read7.scala:6 ] |│ ^ - |└── if (Positioned.debug) { [ mutable-read7.scala:7 ] + |└── if (Positioned.debug) { // warn [ mutable-read7.scala:7 ] | ^^^^^^^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read7.scala b/tests/init-global/warn/mutable-read7.scala index 83da25fc0c25..952628d8e09c 100644 --- a/tests/init-global/warn/mutable-read7.scala +++ b/tests/init-global/warn/mutable-read7.scala @@ -4,10 +4,10 @@ object Positioned: var nextId: Int = 0 abstract class Positioned: - if (Positioned.debug) { + if (Positioned.debug) { // warn println("do debugging") } object Trees: class Tree extends Positioned - val emptyTree = new Tree + val emptyTree = new Tree \ No newline at end of file diff --git a/tests/init-global/warn/mutable-read8.check b/tests/init-global/warn/mutable-read8.check index 030208a605dd..4527a2e5e5d8 100644 --- a/tests/init-global/warn/mutable-read8.check +++ b/tests/init-global/warn/mutable-read8.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/mutable-read8.scala:6:12 ------------------------------------------------------------- -6 | if (Stats.monitored) println("record stats") +-- Warning: tests/init-global/warn/mutable-read8.scala:6:12 ------------------------------------------------------------ +6 | if (Stats.monitored) println("record stats") // warn | ^^^^^^^^^^^^^^^ |Reading mutable state of object Stats during initialization of object NoCompleter. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: @@ -9,6 +9,5 @@ |│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |├── class UncachedGroundType { [ mutable-read8.scala:5 ] |│ ^ - |└── if (Stats.monitored) println("record stats") [ mutable-read8.scala:6 ] + |└── if (Stats.monitored) println("record stats") // warn [ mutable-read8.scala:6 ] | ^^^^^^^^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/mutable-read8.scala b/tests/init-global/warn/mutable-read8.scala index 7dc55830cee4..1481cdb0f83c 100644 --- a/tests/init-global/warn/mutable-read8.scala +++ b/tests/init-global/warn/mutable-read8.scala @@ -3,9 +3,9 @@ object Stats { } class UncachedGroundType { - if (Stats.monitored) println("record stats") + if (Stats.monitored) println("record stats") // warn } class LazyType extends UncachedGroundType -object NoCompleter extends LazyType +object NoCompleter extends LazyType \ No newline at end of file diff --git a/tests/init-global/warn/partial-ordering.check b/tests/init-global/warn/partial-ordering.check index d7a71995dd4c..1f8ace07f6c3 100644 --- a/tests/init-global/warn/partial-ordering.check +++ b/tests/init-global/warn/partial-ordering.check @@ -1,8 +1,8 @@ --- Warning: tests/init-global/neg/partial-ordering.scala:1:7 ----------------------------------------------------------- -1 |object Names: +-- Warning: tests/init-global/warn/partial-ordering.scala:1:7 ---------------------------------------------------------- +1 |object Names: // warn | ^ | Cyclic initialization: object Names -> object MethodName -> object Names. Calling trace: - | ├── object Names: [ partial-ordering.scala:1 ] + | ├── object Names: // warn [ partial-ordering.scala:1 ] | │ ^ | ├── val ctorName: MethodName = MethodName.apply(ctorString) [ partial-ordering.scala:3 ] | │ ^^^^^^^^^^ @@ -10,4 +10,3 @@ | │ ^ | └── val ctor: MethodName = new MethodName(Names.ctorString) [ partial-ordering.scala:7 ] | ^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/partial-ordering.scala b/tests/init-global/warn/partial-ordering.scala index d0e05c13174e..1c932014bba1 100644 --- a/tests/init-global/warn/partial-ordering.scala +++ b/tests/init-global/warn/partial-ordering.scala @@ -1,8 +1,8 @@ -object Names: +object Names: // warn val ctorString = "" val ctorName: MethodName = MethodName.apply(ctorString) class MethodName(encoded: String) object MethodName: val ctor: MethodName = new MethodName(Names.ctorString) - def apply(name: String): MethodName = new MethodName(name) + def apply(name: String): MethodName = new MethodName(name) \ No newline at end of file diff --git a/tests/init-global/warn/patmat-unapplySeq.check b/tests/init-global/warn/patmat-unapplySeq.check index 8131e730b8b2..e46de1d60910 100644 --- a/tests/init-global/warn/patmat-unapplySeq.check +++ b/tests/init-global/warn/patmat-unapplySeq.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/patmat-unapplySeq.scala:8:32 --------------------------------------------------------- -8 | def apply(i: Int): Box = array(i) +-- Warning: tests/init-global/warn/patmat-unapplySeq.scala:8:32 -------------------------------------------------------- +8 | def apply(i: Int): Box = array(i) // warn | ^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: @@ -7,6 +7,5 @@ |│ ^ |├── case A(b) => [ patmat-unapplySeq.scala:17 ] |│ ^^^^ - |└── def apply(i: Int): Box = array(i) [ patmat-unapplySeq.scala:8 ] + |└── def apply(i: Int): Box = array(i) // warn [ patmat-unapplySeq.scala:8 ] | ^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/patmat-unapplySeq.scala b/tests/init-global/warn/patmat-unapplySeq.scala index 1849cf0478e1..4c87846c8430 100644 --- a/tests/init-global/warn/patmat-unapplySeq.scala +++ b/tests/init-global/warn/patmat-unapplySeq.scala @@ -5,7 +5,7 @@ object A: array(0) = new Box(10) def length: Int = array.length - def apply(i: Int): Box = array(i) + def apply(i: Int): Box = array(i) // warn def drop(n: Int): Seq[Box] = array.toSeq def toSeq: Seq[Box] = array.toSeq @@ -15,4 +15,3 @@ object A: object B: A.array match case A(b) => - diff --git a/tests/init-global/warn/patmat-unapplySeq2.check b/tests/init-global/warn/patmat-unapplySeq2.check index 57a67452c10f..5b5c89122f67 100644 --- a/tests/init-global/warn/patmat-unapplySeq2.check +++ b/tests/init-global/warn/patmat-unapplySeq2.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/patmat-unapplySeq2.scala:8:32 -------------------------------------------------------- -8 | def apply(i: Int): Box = array(i) +-- Warning: tests/init-global/warn/patmat-unapplySeq2.scala:8:32 ------------------------------------------------------- +8 | def apply(i: Int): Box = array(i) // warn | ^^^^^^^^ |Reading mutable state of object A during initialization of object B. |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: @@ -7,6 +7,5 @@ |│ ^ |├── case A(b*) => [ patmat-unapplySeq2.scala:17 ] |│ ^^^^^ - |└── def apply(i: Int): Box = array(i) [ patmat-unapplySeq2.scala:8 ] + |└── def apply(i: Int): Box = array(i) // warn [ patmat-unapplySeq2.scala:8 ] | ^^^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/patmat-unapplySeq2.scala b/tests/init-global/warn/patmat-unapplySeq2.scala index c93b05650a8e..7ebf435b5508 100644 --- a/tests/init-global/warn/patmat-unapplySeq2.scala +++ b/tests/init-global/warn/patmat-unapplySeq2.scala @@ -5,7 +5,7 @@ object A: array(0) = new Box(10) def length: Int = array.length - def apply(i: Int): Box = array(i) + def apply(i: Int): Box = array(i) // warn def drop(n: Int): Seq[Box] = array.toSeq def toSeq: Seq[Box] = array.toSeq @@ -15,4 +15,3 @@ object A: object B: A.array match case A(b*) => - diff --git a/tests/init-global/warn/patmat.check b/tests/init-global/warn/patmat.check index e05d144db7ce..603aacdc451c 100644 --- a/tests/init-global/warn/patmat.check +++ b/tests/init-global/warn/patmat.check @@ -1,8 +1,8 @@ --- Warning: tests/init-global/neg/patmat.scala:1:7 --------------------------------------------------------------------- -1 |object A: +-- Warning: tests/init-global/warn/patmat.scala:1:7 -------------------------------------------------------------------- +1 |object A: // warn | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | ├── object A: [ patmat.scala:1 ] + | ├── object A: // warn [ patmat.scala:1 ] | │ ^ | ├── case Some(x) => println(x * 2 + B.a.size) [ patmat.scala:4 ] | │ ^ @@ -10,11 +10,11 @@ | │ ^ | └── if A.a.isEmpty then println(xs.size) [ patmat.scala:12 ] | ^ --- Warning: tests/init-global/neg/patmat.scala:29:9 -------------------------------------------------------------------- -29 | object Inner: +-- Warning: tests/init-global/warn/patmat.scala:29:9 ------------------------------------------------------------------- +29 | object Inner: // warn | ^ | Cyclic initialization: object Inner -> object C -> object Inner. Calling trace: - | ├── object Inner: [ patmat.scala:29 ] + | ├── object Inner: // warn [ patmat.scala:29 ] | │ ^ | ├── case Box(f) => f() [ patmat.scala:35 ] | │ ^^^ @@ -24,4 +24,3 @@ | │ ^ | └── val a: Int = Inner.b [ patmat.scala:27 ] | ^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/patmat.scala b/tests/init-global/warn/patmat.scala index 0d3e74e42cbe..6ac51f948464 100644 --- a/tests/init-global/warn/patmat.scala +++ b/tests/init-global/warn/patmat.scala @@ -1,4 +1,4 @@ -object A: +object A: // warn val a: Option[Int] = Some(3) a match case Some(x) => println(x * 2 + B.a.size) @@ -26,7 +26,7 @@ object C: val a: Int = Inner.b - object Inner: + object Inner: // warn val b: Int = 10 val foo: () => Int = () => C.a @@ -34,4 +34,3 @@ object C: (Box(foo): Box[() => Int] | Holder[Int]) match case Box(f) => f() case Holder(x) => x - diff --git a/tests/init-global/warn/return.check b/tests/init-global/warn/return.check index a420b2bab4c3..9f84dae62554 100644 --- a/tests/init-global/warn/return.check +++ b/tests/init-global/warn/return.check @@ -1,11 +1,10 @@ --- Warning: tests/init-global/neg/return.scala:4:31 -------------------------------------------------------------------- -4 | return (a: Int) => a + B.n +-- Warning: tests/init-global/warn/return.scala:4:31 ------------------------------------------------------------------- +4 | return (a: Int) => a + B.n // warn | ^^^ | Access uninitialized field value n. Calling trace: | ├── object B: [ return.scala:8 ] | │ ^ | ├── val n = A.foo(-10)(20) [ return.scala:9 ] | │ ^^^^^^^^^^^^^^ - | └── return (a: Int) => a + B.n [ return.scala:4 ] + | └── return (a: Int) => a + B.n // warn [ return.scala:4 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/return.scala b/tests/init-global/warn/return.scala index fb138d381fa5..46f4a6cb4b10 100644 --- a/tests/init-global/warn/return.scala +++ b/tests/init-global/warn/return.scala @@ -1,11 +1,10 @@ object A: def foo(x: Int): Int => Int = if x <= 0 then - return (a: Int) => a + B.n + return (a: Int) => a + B.n // warn (a: Int) => a * a + x object B: val n = A.foo(-10)(20) - diff --git a/tests/init-global/warn/return2.check b/tests/init-global/warn/return2.check index e0d9a6e33b14..58f43f383e5d 100644 --- a/tests/init-global/warn/return2.check +++ b/tests/init-global/warn/return2.check @@ -1,15 +1,14 @@ --- Warning: tests/init-global/neg/return2.scala:3:30 ------------------------------------------------------------------- -3 | val f = (a: Int) => a + B.n +-- Warning: tests/init-global/warn/return2.scala:3:30 ------------------------------------------------------------------ +3 | val f = (a: Int) => a + B.n // warn | ^^^ | Access uninitialized field value n. Calling trace: | ├── object B: [ return2.scala:12 ] | │ ^ | ├── val n = A.foo(-10)(20) [ return2.scala:13 ] | │ ^^^^^^^^^^^^^^ - | └── val f = (a: Int) => a + B.n [ return2.scala:3 ] + | └── val f = (a: Int) => a + B.n // warn [ return2.scala:3 ] | ^^^ --- Warning: tests/init-global/neg/return2.scala:6:18 ------------------------------------------------------------------- -6 | val g = () => return f +-- Warning: tests/init-global/warn/return2.scala:6:18 ------------------------------------------------------------------ +6 | val g = () => return f // warn | ^^^^^^^^ | Non local returns are no longer supported; use `boundary` and `boundary.break` in `scala.util` instead -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/return2.scala b/tests/init-global/warn/return2.scala index c41154e8caa5..7c9bdc8dbadb 100644 --- a/tests/init-global/warn/return2.scala +++ b/tests/init-global/warn/return2.scala @@ -1,9 +1,9 @@ object A: def foo(x: Int): Int => Int = - val f = (a: Int) => a + B.n + val f = (a: Int) => a + B.n // warn var i = 0 - val g = () => return f + val g = () => return f // warn if x <= 0 then g() @@ -11,4 +11,3 @@ object A: object B: val n = A.foo(-10)(20) - diff --git a/tests/init-global/warn/t5366.check b/tests/init-global/warn/t5366.check index 3aeda68fd96f..31091a8b7460 100644 --- a/tests/init-global/warn/t5366.check +++ b/tests/init-global/warn/t5366.check @@ -1,21 +1,20 @@ --- Warning: tests/init-global/neg/t5366.scala:3:12 --------------------------------------------------------------------- -3 |case object ObjA extends IdAndMsg(1) +-- Warning: tests/init-global/warn/t5366.scala:3:12 -------------------------------------------------------------------- +3 |case object ObjA extends IdAndMsg(1) // warn | ^ | Cyclic initialization: object ObjA -> object IdAndMsg -> object ObjA. Calling trace: - | ├── case object ObjA extends IdAndMsg(1) [ t5366.scala:3 ] + | ├── case object ObjA extends IdAndMsg(1) // warn [ t5366.scala:3 ] | │ ^ - | ├── object IdAndMsg { [ t5366.scala:6 ] + | ├── object IdAndMsg { // warn [ t5366.scala:6 ] | │ ^ | └── val values = List(ObjA , ObjB) [ t5366.scala:7 ] | ^^^^ --- Warning: tests/init-global/neg/t5366.scala:6:7 ---------------------------------------------------------------------- -6 |object IdAndMsg { +-- Warning: tests/init-global/warn/t5366.scala:6:7 --------------------------------------------------------------------- +6 |object IdAndMsg { // warn | ^ | Cyclic initialization: object IdAndMsg -> object ObjB -> object IdAndMsg. Calling trace: - | ├── object IdAndMsg { [ t5366.scala:6 ] + | ├── object IdAndMsg { // warn [ t5366.scala:6 ] | │ ^ | ├── val values = List(ObjA , ObjB) [ t5366.scala:7 ] | │ ^^^^ | └── case object ObjB extends IdAndMsg(2) [ t5366.scala:4 ] | ^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/t5366.scala b/tests/init-global/warn/t5366.scala index 2c1b18889a2d..be333cbaf183 100644 --- a/tests/init-global/warn/t5366.scala +++ b/tests/init-global/warn/t5366.scala @@ -1,9 +1,9 @@ class IdAndMsg(val id: Int, val msg: String = "") -case object ObjA extends IdAndMsg(1) +case object ObjA extends IdAndMsg(1) // warn case object ObjB extends IdAndMsg(2) -object IdAndMsg { +object IdAndMsg { // warn val values = List(ObjA , ObjB) } @@ -12,4 +12,4 @@ object Test { ObjA println(IdAndMsg.values) } -} +} \ No newline at end of file diff --git a/tests/init-global/warn/t9115.check b/tests/init-global/warn/t9115.check index a55c2eb151a1..7d85026eb970 100644 --- a/tests/init-global/warn/t9115.check +++ b/tests/init-global/warn/t9115.check @@ -1,21 +1,20 @@ --- Warning: tests/init-global/neg/t9115.scala:4:14 --------------------------------------------------------------------- -4 | case object D1 extends Z(aaa) +-- Warning: tests/init-global/warn/t9115.scala:4:14 -------------------------------------------------------------------- +4 | case object D1 extends Z(aaa) // warn | ^ | Cyclic initialization: object D1 -> object D -> object D1. Calling trace: - | ├── case object D1 extends Z(aaa) [ t9115.scala:4 ] + | ├── case object D1 extends Z(aaa) // warn [ t9115.scala:4 ] | │ ^^^ - | ├── object D { [ t9115.scala:1 ] + | ├── object D { // warn [ t9115.scala:1 ] | │ ^ | └── println(D1) [ t9115.scala:6 ] | ^^ --- Warning: tests/init-global/neg/t9115.scala:1:7 ---------------------------------------------------------------------- -1 |object D { +-- Warning: tests/init-global/warn/t9115.scala:1:7 --------------------------------------------------------------------- +1 |object D { // warn | ^ | Cyclic initialization: object D -> object D2 -> object D. Calling trace: - | ├── object D { [ t9115.scala:1 ] + | ├── object D { // warn [ t9115.scala:1 ] | │ ^ | ├── println(D2) [ t9115.scala:7 ] | │ ^^ | └── case object D2 extends Z(aaa) // 'null' when calling D.D2 first time [ t9115.scala:5 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/t9115.scala b/tests/init-global/warn/t9115.scala index fc1e8e72c6e3..a5062c1aa10b 100644 --- a/tests/init-global/warn/t9115.scala +++ b/tests/init-global/warn/t9115.scala @@ -1,9 +1,8 @@ -object D { +object D { // warn def aaa = 1 //that’s the reason class Z (depends: Any) - case object D1 extends Z(aaa) + case object D1 extends Z(aaa) // warn case object D2 extends Z(aaa) // 'null' when calling D.D2 first time println(D1) println(D2) } - diff --git a/tests/init-global/warn/t9261.check b/tests/init-global/warn/t9261.check index dbda32347e74..1e8b05d1ffa2 100644 --- a/tests/init-global/warn/t9261.check +++ b/tests/init-global/warn/t9261.check @@ -1,9 +1,8 @@ --- Warning: tests/init-global/neg/t9261.scala:2:12 --------------------------------------------------------------------- -2 |case object Buy extends OrderType(Sell) +-- Warning: tests/init-global/warn/t9261.scala:2:12 -------------------------------------------------------------------- +2 |case object Buy extends OrderType(Sell) // warn | ^ | Cyclic initialization: object Buy -> object Sell -> object Buy. Calling trace: - | ├── case object Buy extends OrderType(Sell) [ t9261.scala:2 ] + | ├── case object Buy extends OrderType(Sell) // warn [ t9261.scala:2 ] | │ ^^^^ | └── case object Sell extends OrderType(Buy) [ t9261.scala:3 ] | ^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/t9261.scala b/tests/init-global/warn/t9261.scala index 0888337d7a94..fcb2f3c62901 100644 --- a/tests/init-global/warn/t9261.scala +++ b/tests/init-global/warn/t9261.scala @@ -1,4 +1,3 @@ sealed abstract class OrderType(val reverse: OrderType) -case object Buy extends OrderType(Sell) +case object Buy extends OrderType(Sell) // warn case object Sell extends OrderType(Buy) - diff --git a/tests/init-global/warn/t9312.check b/tests/init-global/warn/t9312.check index d6f1b00b1a09..2a2aed6d9a40 100644 --- a/tests/init-global/warn/t9312.check +++ b/tests/init-global/warn/t9312.check @@ -1,22 +1,22 @@ --- Warning: tests/init-global/neg/t9312.scala:18:11 -------------------------------------------------------------------- -18 | object Child1 extends Child +-- Warning: tests/init-global/warn/t9312.scala:18:11 ------------------------------------------------------------------- +18 | object Child1 extends Child // warn | ^ | Cyclic initialization: object Child1 -> object Parent -> object Child1. Calling trace: - | ├── object Child1 extends Child [ t9312.scala:18 ] + | ├── object Child1 extends Child // warn [ t9312.scala:18 ] | │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ├── trait Child { [ t9312.scala:12 ] | │ ^ | ├── val parent = Parent [ t9312.scala:14 ] | │ ^^^^^^ - | ├── object Parent { [ t9312.scala:11 ] + | ├── object Parent { // warn [ t9312.scala:11 ] | │ ^ | └── final val children = Set(Child1, Child2) [ t9312.scala:21 ] | ^^^^^^ --- Warning: tests/init-global/neg/t9312.scala:11:9 --------------------------------------------------------------------- -11 | object Parent { +-- Warning: tests/init-global/warn/t9312.scala:11:9 -------------------------------------------------------------------- +11 | object Parent { // warn | ^ | Cyclic initialization: object Parent -> object Child2 -> object Parent. Calling trace: - | ├── object Parent { [ t9312.scala:11 ] + | ├── object Parent { // warn [ t9312.scala:11 ] | │ ^ | ├── final val children = Set(Child1, Child2) [ t9312.scala:21 ] | │ ^^^^^^ @@ -26,4 +26,3 @@ | │ ^ | └── val parent = Parent [ t9312.scala:14 ] | ^^^^^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/t9312.scala b/tests/init-global/warn/t9312.scala index d06a7f1bcefb..68282ff9e3e6 100644 --- a/tests/init-global/warn/t9312.scala +++ b/tests/init-global/warn/t9312.scala @@ -8,17 +8,16 @@ object DeadLockTest { } - object Parent { + object Parent { // warn trait Child { Thread.sleep(2000) // ensure concurrent behavior val parent = Parent def siblings = parent.children - this } - object Child1 extends Child + object Child1 extends Child // warn object Child2 extends Child final val children = Set(Child1, Child2) } } - diff --git a/tests/init-global/warn/t9360.check b/tests/init-global/warn/t9360.check index 23ceea224a10..2d77b8c1055a 100644 --- a/tests/init-global/warn/t9360.check +++ b/tests/init-global/warn/t9360.check @@ -1,21 +1,20 @@ --- Warning: tests/init-global/neg/t9360.scala:8:9 ---------------------------------------------------------------------- -8 | object AObj extends BaseClass(s) +-- Warning: tests/init-global/warn/t9360.scala:8:9 --------------------------------------------------------------------- +8 | object AObj extends BaseClass(s) // warn | ^ | Cyclic initialization: object AObj -> object Obj -> object AObj. Calling trace: - | ├── object AObj extends BaseClass(s) [ t9360.scala:8 ] + | ├── object AObj extends BaseClass(s) // warn [ t9360.scala:8 ] | │ ^ - | ├── object Obj { [ t9360.scala:5 ] + | ├── object Obj { // warn [ t9360.scala:5 ] | │ ^ | └── val list = List(AObj, BObj) [ t9360.scala:12 ] | ^^^^ --- Warning: tests/init-global/neg/t9360.scala:5:7 ---------------------------------------------------------------------- -5 |object Obj { +-- Warning: tests/init-global/warn/t9360.scala:5:7 --------------------------------------------------------------------- +5 |object Obj { // warn | ^ | Cyclic initialization: object Obj -> object BObj -> object Obj. Calling trace: - | ├── object Obj { [ t9360.scala:5 ] + | ├── object Obj { // warn [ t9360.scala:5 ] | │ ^ | ├── val list = List(AObj, BObj) [ t9360.scala:12 ] | │ ^^^^ | └── object BObj extends BaseClass(s) [ t9360.scala:10 ] | ^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/t9360.scala b/tests/init-global/warn/t9360.scala index 423da308064b..3f5464637457 100644 --- a/tests/init-global/warn/t9360.scala +++ b/tests/init-global/warn/t9360.scala @@ -2,10 +2,10 @@ class BaseClass(s: String) { def print: Unit = () } -object Obj { +object Obj { // warn val s: String = "hello" - object AObj extends BaseClass(s) + object AObj extends BaseClass(s) // warn object BObj extends BaseClass(s) @@ -23,4 +23,3 @@ object ObjectInit { Obj.print } } - diff --git a/tests/init-global/warn/unapply-implicit-arg.check b/tests/init-global/warn/unapply-implicit-arg.check index 4e45d79e7e14..37458a878319 100644 --- a/tests/init-global/warn/unapply-implicit-arg.check +++ b/tests/init-global/warn/unapply-implicit-arg.check @@ -1,9 +1,8 @@ --- Warning: tests/init-global/neg/unapply-implicit-arg.scala:11:16 ----------------------------------------------------- -11 | val i2: Int = i2 match +-- Warning: tests/init-global/warn/unapply-implicit-arg.scala:11:16 ---------------------------------------------------- +11 | val i2: Int = i2 match // warn | ^^ | Access uninitialized field value i2. Calling trace: | ├── object Bar { [ unapply-implicit-arg.scala:1 ] | │ ^ - | └── val i2: Int = i2 match [ unapply-implicit-arg.scala:11 ] + | └── val i2: Int = i2 match // warn [ unapply-implicit-arg.scala:11 ] | ^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/unapply-implicit-arg.scala b/tests/init-global/warn/unapply-implicit-arg.scala index 5bccff951b4d..89c9fe9e2d04 100644 --- a/tests/init-global/warn/unapply-implicit-arg.scala +++ b/tests/init-global/warn/unapply-implicit-arg.scala @@ -8,7 +8,7 @@ object Bar { given Foo = new Foo val i1: Int = 0 - val i2: Int = i2 match + val i2: Int = i2 match // warn case Bar(i) => i case _ => 0 -} +} \ No newline at end of file diff --git a/tests/init-global/warn/unapply-implicit-arg2.check b/tests/init-global/warn/unapply-implicit-arg2.check index ec317d59f1bd..f04473c64a17 100644 --- a/tests/init-global/warn/unapply-implicit-arg2.check +++ b/tests/init-global/warn/unapply-implicit-arg2.check @@ -1,13 +1,12 @@ --- Warning: tests/init-global/neg/unapply-implicit-arg2.scala:7:51 ----------------------------------------------------- -7 | if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) +-- Warning: tests/init-global/warn/unapply-implicit-arg2.scala:7:51 ---------------------------------------------------- +7 | if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) // warn | ^^ - | Access uninitialized field value i2. Calling trace: - | ├── object Bar { [ unapply-implicit-arg2.scala:1 ] - | │ ^ - | ├── case Bar(i) => i [ unapply-implicit-arg2.scala:12 ] - | │ ^^^^^^ - | ├── def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg2.scala:6 ] - | │ ^ - | └── if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) [ unapply-implicit-arg2.scala:7 ] - | ^^ -No warnings can be incurred under -Werror. + | Access uninitialized field value i2. Calling trace: + | ├── object Bar { [ unapply-implicit-arg2.scala:1 ] + | │ ^ + | ├── case Bar(i) => i [ unapply-implicit-arg2.scala:12 ] + | │ ^^^^^^ + | ├── def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg2.scala:6 ] + | │ ^ + | └── if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) // warn [ unapply-implicit-arg2.scala:7 ] + | ^^ diff --git a/tests/init-global/warn/unapply-implicit-arg2.scala b/tests/init-global/warn/unapply-implicit-arg2.scala index 7e1e53881f2e..bec427d4489d 100644 --- a/tests/init-global/warn/unapply-implicit-arg2.scala +++ b/tests/init-global/warn/unapply-implicit-arg2.scala @@ -4,7 +4,7 @@ object Bar { def m2(i: Int) = i+2 } def unapply(using f1: Foo)(i: Int): Option[Int] = - if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) + if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) // warn given Foo = new Foo val i1: Int = 0 @@ -12,4 +12,3 @@ object Bar { case Bar(i) => i case _ => 0 } - diff --git a/tests/init-global/warn/unapply-implicit-arg3.check b/tests/init-global/warn/unapply-implicit-arg3.check index 3bb9c0ad2930..18503ac0670b 100644 --- a/tests/init-global/warn/unapply-implicit-arg3.check +++ b/tests/init-global/warn/unapply-implicit-arg3.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/unapply-implicit-arg3.scala:4:25 ----------------------------------------------------- -4 | def m2(i: Int) = i + i2 +-- Warning: tests/init-global/warn/unapply-implicit-arg3.scala:4:25 ---------------------------------------------------- +4 | def m2(i: Int) = i + i2 // warn | ^^ | Access uninitialized field value i2. Calling trace: | ├── object Bar { [ unapply-implicit-arg3.scala:1 ] @@ -10,6 +10,5 @@ | │ ^ | ├── if i == 0 then Some(f1.m1(i)) else Some(f1.m2(i)) [ unapply-implicit-arg3.scala:7 ] | │ ^^^^^^^^ - | └── def m2(i: Int) = i + i2 [ unapply-implicit-arg3.scala:4 ] + | └── def m2(i: Int) = i + i2 // warn [ unapply-implicit-arg3.scala:4 ] | ^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/unapply-implicit-arg3.scala b/tests/init-global/warn/unapply-implicit-arg3.scala index 1d2fa76d5299..ae7a7a8315da 100644 --- a/tests/init-global/warn/unapply-implicit-arg3.scala +++ b/tests/init-global/warn/unapply-implicit-arg3.scala @@ -1,7 +1,7 @@ object Bar { class Foo { def m1(i: Int) = i + i1 - def m2(i: Int) = i + i2 + def m2(i: Int) = i + i2 // warn } def unapply(using f1: Foo)(i: Int): Option[Int] = if i == 0 then Some(f1.m1(i)) else Some(f1.m2(i)) @@ -12,4 +12,3 @@ object Bar { case Bar(i) => i case _ => 0 } - diff --git a/tests/init-global/warn/unapplySeq-implicit-arg.check b/tests/init-global/warn/unapplySeq-implicit-arg.check index d021cd1f5d94..ec08187f058f 100644 --- a/tests/init-global/warn/unapplySeq-implicit-arg.check +++ b/tests/init-global/warn/unapplySeq-implicit-arg.check @@ -1,9 +1,8 @@ --- Warning: tests/init-global/neg/unapplySeq-implicit-arg.scala:11:20 -------------------------------------------------- -11 | val i2: Int = Seq(i2) match +-- Warning: tests/init-global/warn/unapplySeq-implicit-arg.scala:11:20 ------------------------------------------------- +11 | val i2: Int = Seq(i2) match // warn | ^^ | Access uninitialized field value i2. Calling trace: | ├── object Bar { [ unapplySeq-implicit-arg.scala:1 ] | │ ^ - | └── val i2: Int = Seq(i2) match [ unapplySeq-implicit-arg.scala:11 ] + | └── val i2: Int = Seq(i2) match // warn [ unapplySeq-implicit-arg.scala:11 ] | ^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/unapplySeq-implicit-arg.scala b/tests/init-global/warn/unapplySeq-implicit-arg.scala index 31e16e74897a..1b06fadca63f 100644 --- a/tests/init-global/warn/unapplySeq-implicit-arg.scala +++ b/tests/init-global/warn/unapplySeq-implicit-arg.scala @@ -8,8 +8,7 @@ object Bar { given Foo = new Foo val i1: Int = 0 - val i2: Int = Seq(i2) match + val i2: Int = Seq(i2) match // warn case Bar(i) => i case _ => 0 } - diff --git a/tests/init-global/warn/unapplySeq-implicit-arg2.check b/tests/init-global/warn/unapplySeq-implicit-arg2.check index 2e5164d7b405..e75b66495d4b 100644 --- a/tests/init-global/warn/unapplySeq-implicit-arg2.check +++ b/tests/init-global/warn/unapplySeq-implicit-arg2.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/unapplySeq-implicit-arg2.scala:4:9 --------------------------------------------------- -4 | Some(i1 +: seqi) +-- Warning: tests/init-global/warn/unapplySeq-implicit-arg2.scala:4:9 -------------------------------------------------- +4 | Some(i1 +: seqi) // warn | ^^ |Access uninitialized field value i1. Calling trace: |├── object Bar { [ unapplySeq-implicit-arg2.scala:1 ] @@ -8,6 +8,5 @@ |│ ^^^^^^ |├── def unapplySeq(using f1: Foo)(using f2: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = [ unapplySeq-implicit-arg2.scala:3 ] |│ ^ - |└── Some(i1 +: seqi) [ unapplySeq-implicit-arg2.scala:4 ] + |└── Some(i1 +: seqi) // warn [ unapplySeq-implicit-arg2.scala:4 ] | ^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/unapplySeq-implicit-arg2.scala b/tests/init-global/warn/unapplySeq-implicit-arg2.scala index 0d506c778e17..adac49ade28d 100644 --- a/tests/init-global/warn/unapplySeq-implicit-arg2.scala +++ b/tests/init-global/warn/unapplySeq-implicit-arg2.scala @@ -1,11 +1,10 @@ object Bar { class Foo def unapplySeq(using f1: Foo)(using f2: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = - Some(i1 +: seqi) + Some(i1 +: seqi) // warn given Foo = new Foo val i1: Int = Seq(0) match { case Bar(i) => i case _ => 0 } } - diff --git a/tests/init-global/warn/unapplySeq-implicit-arg3.check b/tests/init-global/warn/unapplySeq-implicit-arg3.check index 59ea56320452..7674298a3665 100644 --- a/tests/init-global/warn/unapplySeq-implicit-arg3.check +++ b/tests/init-global/warn/unapplySeq-implicit-arg3.check @@ -1,5 +1,5 @@ --- Warning: tests/init-global/neg/unapplySeq-implicit-arg3.scala:3:27 -------------------------------------------------- -3 | def m(seq: Seq[Int]) = i1 +: seq +-- Warning: tests/init-global/warn/unapplySeq-implicit-arg3.scala:3:27 ------------------------------------------------- +3 | def m(seq: Seq[Int]) = i1 +: seq // warn | ^^ |Access uninitialized field value i1. Calling trace: |├── object Bar { [ unapplySeq-implicit-arg3.scala:1 ] @@ -10,6 +10,5 @@ |│ ^ |├── Some(f1.m(seqi)) [ unapplySeq-implicit-arg3.scala:6 ] |│ ^^^^^^^^^^ - |└── def m(seq: Seq[Int]) = i1 +: seq [ unapplySeq-implicit-arg3.scala:3 ] + |└── def m(seq: Seq[Int]) = i1 +: seq // warn [ unapplySeq-implicit-arg3.scala:3 ] | ^^ -No warnings can be incurred under -Werror. diff --git a/tests/init-global/warn/unapplySeq-implicit-arg3.scala b/tests/init-global/warn/unapplySeq-implicit-arg3.scala index c941e9b6f65c..ab576ed78149 100644 --- a/tests/init-global/warn/unapplySeq-implicit-arg3.scala +++ b/tests/init-global/warn/unapplySeq-implicit-arg3.scala @@ -1,6 +1,6 @@ object Bar { class Foo { - def m(seq: Seq[Int]) = i1 +: seq + def m(seq: Seq[Int]) = i1 +: seq // warn } def unapplySeq(using f1: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = Some(f1.m(seqi)) @@ -10,4 +10,3 @@ object Bar { case _ => 0 } } -