Skip to content

Commit c018549

Browse files
committed
Fixing global-init WIP
1 parent 17b6e5a commit c018549

File tree

250 files changed

+283
-242
lines changed

Some content is hidden

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

250 files changed

+283
-242
lines changed

tests/init-global/neg/context-sensitivity.check

Whitespace-only changes.

tests/init-global/neg/context-sensitivity.scala

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ object A:
1515
val box1: Box = new Box(new C(5))
1616
val box2: Box = new Box(new D(10))
1717
val m: Int = box1.value.foo()
18+
19+
// nopos-error: No warnings can be incurred under -Werror.
Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +0,0 @@
1-
-- Error: tests/init-global/neg/global-cycle1.scala:1:7 ----------------------------------------------------------------
2-
1 |object A { // error
3-
| ^
4-
| Cyclic initialization: object A -> object B -> object A. Calling trace:
5-
| -> object A { // error [ global-cycle1.scala:1 ]
6-
| ^
7-
| -> val a: Int = B.b [ global-cycle1.scala:2 ]
8-
| ^
9-
| -> object B { [ global-cycle1.scala:5 ]
10-
| ^
11-
| -> val b: Int = A.a // error [ global-cycle1.scala:6 ]
12-
| ^
13-
-- Error: tests/init-global/neg/global-cycle1.scala:6:17 ---------------------------------------------------------------
14-
6 | val b: Int = A.a // error
15-
| ^^^
16-
| Access uninitialized field value a. Call trace:
17-
| -> object B { [ global-cycle1.scala:5 ]
18-
| ^
19-
| -> val b: Int = A.a // error [ global-cycle1.scala:6 ]
20-
| ^^^

tests/init-global/neg/global-cycle1.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ object B {
88

99
@main
1010
def Test = print(A.a)
11+
12+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle14.check

Whitespace-only changes.

tests/init-global/neg/global-cycle14.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ object A { // error
1212
object B {
1313
val m: Int = A.n // error
1414
}
15+
16+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle2.check

Whitespace-only changes.

tests/init-global/neg/global-cycle2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ object A {
55
object B {
66
def foo(): Int = A.a * 2 // error
77
}
8+
9+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle3.check

Whitespace-only changes.

tests/init-global/neg/global-cycle3.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ class A(x: Int) {
55
object B {
66
val a: Int = A(4).foo()
77
}
8+
9+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle4.check

Whitespace-only changes.

tests/init-global/neg/global-cycle4.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ class D(x: Int) {
1717
object O {
1818
val a: Int = D(5).bar().foo()
1919
}
20+
21+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle5.check

Whitespace-only changes.

tests/init-global/neg/global-cycle5.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ object C {
2020

2121
def main = {
2222
A.a = new Y(); C
23-
}
23+
}
24+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle6.check

Whitespace-only changes.

tests/init-global/neg/global-cycle6.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ object O {
2222
val a = new A.Inner
2323
val m: Int = 10
2424
}
25-
}
25+
}
26+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle7.check

Whitespace-only changes.

tests/init-global/neg/global-cycle7.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ object JavaTokens extends TokensCommon {
1616
final def maxToken: Int = DOUBLE
1717
final val DOUBLE = 188
1818
}
19+
20+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-cycle8.check

Whitespace-only changes.

tests/init-global/neg/global-cycle8.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ object P {
1818
object Q {
1919
def bar(b: B) = b.a.foo()
2020
}
21+
22+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-irrelevance1.check

Whitespace-only changes.

tests/init-global/neg/global-irrelevance1.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ object A:
22
var x = 6
33

44
object B:
5-
var y = A.x * 2 // error
5+
var y = A.x * 2 // error
6+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-irrelevance2.check

Whitespace-only changes.

tests/init-global/neg/global-irrelevance2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ class B(b: Int):
66

77
object B:
88
new B(10)
9+
10+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-irrelevance3.check

Whitespace-only changes.

tests/init-global/neg/global-irrelevance3.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ object A:
1212

1313
object B:
1414
var y = A.p.g()
15+
16+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-irrelevance4.check

Whitespace-only changes.

tests/init-global/neg/global-irrelevance4.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ object A:
1111

1212
object B:
1313
A.p.f(10)
14+
15+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-irrelevance5.check

Whitespace-only changes.

tests/init-global/neg/global-irrelevance5.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ object A:
44

55
object B:
66
var y = A.array(0) * 2 // error
7+
8+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-irrelevance6.check

Whitespace-only changes.

tests/init-global/neg/global-irrelevance6.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ object A:
77

88
object B:
99
var y = A.array(0).foo() * 2 // error
10+
11+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-irrelevance7.check

Whitespace-only changes.

tests/init-global/neg/global-irrelevance7.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ object A:
88

99
object B:
1010
var y = A.array(0).foo() * 2 // error
11+
12+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-list.check

Whitespace-only changes.

tests/init-global/neg/global-list.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ object O: // error
66
val c = Foo("Cherry")
77

88
object Foo:
9-
val all: List[Foo] = List(O.a, O.b, O.c) // error // error // error
9+
val all: List[Foo] = List(O.a, O.b, O.c) // error // error // error
10+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-local-var.check

Whitespace-only changes.

tests/init-global/neg/global-local-var.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ class A(x: Int) {
1414
object B {
1515
val a: Int = A(4).foo()
1616
}
17+
18+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/global-region1.check

Whitespace-only changes.

tests/init-global/neg/global-region1.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ object A:
77
val box1: Box = new Box(new C(5))
88
val box2: Box = new Box(new D(10))
99
val m: Int = box1.value.foo()
10+
11+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/i11262.check

Whitespace-only changes.

tests/init-global/neg/i11262.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
object A { val x: String = B.y } // error
22
object B { val y: String = A.x } // error
3+
4+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/i12544b.check

Whitespace-only changes.

tests/init-global/neg/i12544b.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ object Enum:
1010
def f(e: Enum): Enum = e
1111

1212
@main def main(): Unit = println(Enum.b)
13+
14+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/i9176.check

Whitespace-only changes.

tests/init-global/neg/i9176.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ object Test {
77
println(B.opposite)
88
}
99
}
10+
11+
// nopos-error: No warnings can be incurred under -Werror.
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +0,0 @@
1-
-- Error: tests/init-global/neg/line-spacing.scala:4:7 -----------------------------------------------------------------
2-
3 | B
3-
4 | .s.length // error
4-
| ^
5-
| Access uninitialized field value s. Call trace:
6-
| -> object B { [ line-spacing.scala:7 ]
7-
| ^
8-
| -> val s: String = s"${A.a}a" [ line-spacing.scala:8 ]
9-
| ^^^
10-
| -> def a: Int = [ line-spacing.scala:2 ]
11-
| ^
12-
| -> .s.length // error [ line-spacing.scala:4 ]
13-
| ^

tests/init-global/neg/line-spacing.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ object A {
77
object B {
88
val s: String = s"${A.a}a"
99
}
10+
11+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-array.check

Whitespace-only changes.

tests/init-global/neg/mutable-array.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ object B:
66
val boxes: Array[A.Box] = Array(A.box)
77
val box: A.Box = boxes(0)
88
val x: Int = box.value // error
9+
10+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read1.check

Whitespace-only changes.

tests/init-global/neg/mutable-read1.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ object B:
77
val boxB: Box = new Box(5)
88
val boxA: Box = A.box
99
val m: Int = boxB.value
10-
val n: Int = boxA.value // error
10+
val n: Int = boxA.value // error
11+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read2.check

Whitespace-only changes.

tests/init-global/neg/mutable-read2.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ object A:
77
object B:
88
val box: A.Box = A.box
99
val a: Int = box.initial
10-
val b: Int = box.value // error
10+
val b: Int = box.value // error
11+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read3.check

Whitespace-only changes.

tests/init-global/neg/mutable-read3.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ object B:
66
val boxes: Array[A.Box] = new Array(1)
77
boxes(0) = A.box
88
val box: A.Box = boxes(0)
9-
val x: Int = box.value // error
9+
val x: Int = box.value // error
10+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read4.check

Whitespace-only changes.

tests/init-global/neg/mutable-read4.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ object B:
77
val boxB: Box = new Box(5)
88
val boxA: Box = A.box
99
val m: Int = boxB.value
10-
val n: Int = boxA.value // error
10+
val n: Int = boxA.value // error
11+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read5.check

Whitespace-only changes.

tests/init-global/neg/mutable-read5.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ object Names:
66
object StdNames:
77
val AnyRef: Names.Name = Names.name("AnyRef")
88
val Array: Names.Name = Names.name("Array")
9-
val List: Names.Name = Names.name("List")
9+
val List: Names.Name = Names.name("List")
10+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read6.check

Whitespace-only changes.

tests/init-global/neg/mutable-read6.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ object Contexts:
1212
object Implicits:
1313
import Contexts.*
1414
case class SearchFailure(tag: Int, source: SourceFile)
15-
val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source)
15+
val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source)
16+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read7.check

Whitespace-only changes.

tests/init-global/neg/mutable-read7.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ abstract class Positioned:
1010

1111
object Trees:
1212
class Tree extends Positioned
13-
val emptyTree = new Tree
13+
val emptyTree = new Tree
14+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/mutable-read8.check

Whitespace-only changes.

tests/init-global/neg/mutable-read8.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ class UncachedGroundType {
88

99
class LazyType extends UncachedGroundType
1010

11-
object NoCompleter extends LazyType
11+
object NoCompleter extends LazyType
12+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/partial-ordering.check

Whitespace-only changes.

tests/init-global/neg/partial-ordering.scala

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ object Names: // error
55
class MethodName(encoded: String)
66
object MethodName:
77
val ctor: MethodName = new MethodName(Names.ctorString)
8-
def apply(name: String): MethodName = new MethodName(name)
8+
def apply(name: String): MethodName = new MethodName(name)
9+
// nopos-error: No warnings can be incurred under -Werror.
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +0,0 @@
1-
-- Error: tests/init-global/neg/patmat-unapplySeq.scala:8:32 -----------------------------------------------------------
2-
8 | def apply(i: Int): Box = array(i) // error
3-
| ^^^^^^^^
4-
|Reading mutable state of object A during initialization of object B.
5-
|Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace:
6-
|-> object B: [ patmat-unapplySeq.scala:15 ]
7-
| ^
8-
|-> case A(b) => [ patmat-unapplySeq.scala:17 ]
9-
| ^^^^
10-
|-> def apply(i: Int): Box = array(i) // error [ patmat-unapplySeq.scala:8 ]
11-
| ^^^^^^^^

tests/init-global/neg/patmat-unapplySeq.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ object A:
1515
object B:
1616
A.array match
1717
case A(b) =>
18+
19+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/patmat-unapplySeq2.check

Whitespace-only changes.

tests/init-global/neg/patmat-unapplySeq2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ object A:
1515
object B:
1616
A.array match
1717
case A(b*) =>
18+
19+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/patmat.check

Whitespace-only changes.

tests/init-global/neg/patmat.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ object C:
3434
(Box(foo): Box[() => Int] | Holder[Int]) match
3535
case Box(f) => f()
3636
case Holder(x) => x
37+
38+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/return.check

Whitespace-only changes.

tests/init-global/neg/return.scala

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ object A:
88
object B:
99
val n = A.foo(-10)(20)
1010

11+
12+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/return2.check

Whitespace-only changes.

tests/init-global/neg/return2.scala

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ object A:
1111

1212
object B:
1313
val n = A.foo(-10)(20)
14+
15+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/t5366.check

Whitespace-only changes.

tests/init-global/neg/t5366.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ object Test {
1212
ObjA
1313
println(IdAndMsg.values)
1414
}
15-
}
15+
}
16+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/t9115.check

Whitespace-only changes.

tests/init-global/neg/t9115.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ object D { // error
66
println(D1)
77
println(D2)
88
}
9+
10+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/t9261.check

Whitespace-only changes.

tests/init-global/neg/t9261.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
sealed abstract class OrderType(val reverse: OrderType)
22
case object Buy extends OrderType(Sell) // error
33
case object Sell extends OrderType(Buy)
4+
5+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/t9312.check

Whitespace-only changes.

tests/init-global/neg/t9312.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ object DeadLockTest {
2121
final val children = Set(Child1, Child2)
2222
}
2323
}
24+
25+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/t9360.check

Whitespace-only changes.

tests/init-global/neg/t9360.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ object ObjectInit {
2323
Obj.print
2424
}
2525
}
26+
27+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/unapply-implicit-arg.check

Whitespace-only changes.

tests/init-global/neg/unapply-implicit-arg.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ object Bar {
1111
val i2: Int = i2 match // error
1212
case Bar(i) => i
1313
case _ => 0
14-
}
14+
}
15+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/unapply-implicit-arg2.check

Whitespace-only changes.

tests/init-global/neg/unapply-implicit-arg2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ object Bar {
1212
case Bar(i) => i
1313
case _ => 0
1414
}
15+
16+
// nopos-error: No warnings can be incurred under -Werror.

tests/init-global/neg/unapply-implicit-arg3.check

Whitespace-only changes.

0 commit comments

Comments
 (0)