Skip to content

Commit 4bd3369

Browse files
authored
Add init test (scala#20356)
Add init test
2 parents b10d64e + 67c68b8 commit 4bd3369

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

compiler/src/dotty/tools/dotc/transform/init/Objects.scala

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import scala.collection.mutable
2929
import scala.annotation.tailrec
3030
import scala.annotation.constructorOnly
3131
import dotty.tools.dotc.core.Flags.AbstractOrTrait
32-
import Decorators.*
3332

3433
/** Check initialization safety of static objects
3534
*

tests/init-global/neg/TypeCast.scala

-18
This file was deleted.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
trait CmdLineParser:
2+
outer =>
3+
4+
val a: String
5+
6+
trait Opt[+T]:
7+
val default: T
8+
val names: Set[String]
9+
val help: String
10+
11+
trait IntOpt extends Opt[Int]:
12+
println("outer = " + outer)
13+
println("outer.a = " + outer.a)
14+
15+
object FirstParser extends CmdLineParser:
16+
object OptMinSuccess extends IntOpt: // warn
17+
val default = 100
18+
val names = Set("bla")
19+
val help = "bla"
20+
21+
val opts = List(OptMinSuccess)
22+
val a = "FirstParser"

0 commit comments

Comments
 (0)