File tree Expand file tree Collapse file tree 13 files changed +51
-43
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 13 files changed +51
-43
lines changed Original file line number Diff line number Diff line change @@ -1140,7 +1140,7 @@ object Semantic:
11401140 */
11411141 def checkClasses (classes : List [ClassSymbol ])(using Context ): Unit =
11421142 given Cache .Data ()
1143- for classSym <- classes if isConcreteClass(classSym) do
1143+ for classSym <- classes if isConcreteClass(classSym) && ! classSym.isStaticObject do
11441144 checkClass(classSym)
11451145
11461146// ----- Semantic definition --------------------------------
Original file line number Diff line number Diff line change 1+ val a = b // error
2+ val b = 1
Original file line number Diff line number Diff line change 1- object O :
1+ class O :
22 case class A (b : B ):
33 println(n)
44
Original file line number Diff line number Diff line change @@ -12,14 +12,14 @@ trait U {
1212 val f2 : Int
1313}
1414
15- object Test0 extends U {
15+ class Test0 extends U {
1616 final val f1 = 1
1717 final val f2 = 2
1818 final val f3 = f1 + f2
1919 val f4 : 3 = f3
2020}
2121
22- object Test1 extends U {
22+ class Test1 extends U {
2323 final val f1 = 1
2424 final val f3 = f1 + f2
2525 final val f2 = 2
@@ -28,7 +28,7 @@ object Test1 extends U {
2828
2929}
3030
31- object Test extends T {
31+ class Test extends T {
3232 override final val f1 = /* super.f1*/ 1 + f2 // error
3333 override final val f2 = 2 // error
3434 override final val f3 = {println(3 ); 3 } // error
@@ -37,7 +37,7 @@ object Test extends T {
3737 def g : 3 = { println(" g" ); 3 }
3838 final val x = g + 1
3939 def main (args : Array [String ]): Unit = {
40- Test0
41- Test1
40+ new Test0
41+ new Test1
4242 }
4343}
Original file line number Diff line number Diff line change @@ -2,18 +2,23 @@ enum Enum:
22 case Case
33 case Case2 (x : Int )
44
5- def g (b : Enum .B ): Int = b.foo()
5+ class Outer :
6+ val e = new Enum2
67
7- object Enum :
8- object nested :
9- val a : Enum = Case
8+ class Enum2 :
9+ class nested :
10+ val a : Enum = Enum . Case
1011
11- val b : Enum = f(nested.a)
12+ val b : Enum = f(( new nested) .a)
1213
13- def f (e : Enum ): Enum = e
14+ def f (e : Enum ): Enum = e
1415
15- class B () { def foo () = n + 1 }
16- g(new B ()) // error
17- val n : Int = 10
16+ class B () { def foo () = n + 1 }
17+ def g (b : B ): Int = b.foo()
18+ g(new B ()) // error
19+ val n : Int = 10
1820
19- @ main def main (): Unit = println(Enum .b)
21+ @ main def main (): Unit = {
22+ val o = new Outer
23+ print(o.e.b)
24+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- object App {
1+ class App {
22 trait A { type L >: Any }
33 def upcast (a : A , x : Any ): a.L = x
44 val p : A { type L <: Nothing } = p // error
Original file line number Diff line number Diff line change 1- object Scanners {
1+ class Scanners {
22 enum IndentWidth {
33 case Run (ch : Char , n : Int )
44 case Conc (l : IndentWidth , r : Run )
Original file line number Diff line number Diff line change 1- object Flags {
2- class Inner {
3- println(b)
4- }
1+ class Outer :
2+ val flags = new Flags // error
53
6- new Flags .Inner
4+ class Flags {
5+ class Inner {
6+ println(b)
7+ }
78
8- val a = this .b + 3
9- val b = 5 // error
10- }
9+ new flags.Inner
1110
12- object Flags2 {
13- class Inner {
14- println(b)
11+ val a = this .b + 3
12+ val b = 5 // error
1513 }
1614
15+ class Flags2 {
16+ class Inner {
17+ println(b)
18+ }
19+
1720
18- lazy val a = 3
19- val b = 5
20- }
21+ lazy val a = 3
22+ val b = 5
23+ }
Original file line number Diff line number Diff line change 2219 | val l2 = l.map(_.m()) // error
33 | ^^^^^^^^^^^^
44 | Call method method map on an uninitialized (Cold) object. Calling trace:
5- | ├── object leakWarm { [ leak-warm.scala:1 ]
5+ | ├── class leakWarm { [ leak-warm.scala:1 ]
66 | │ ^
77 | └── val l2 = l.map(_.m()) // error [ leak-warm.scala:19 ]
88 | ^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments