Skip to content

Commit

Permalink
Add init test (#20356)
Browse files Browse the repository at this point in the history
Add init test
  • Loading branch information
liufengyun authored May 9, 2024
2 parents b10d64e + 67c68b8 commit 4bd3369
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/init/Objects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import scala.collection.mutable
import scala.annotation.tailrec
import scala.annotation.constructorOnly
import dotty.tools.dotc.core.Flags.AbstractOrTrait
import Decorators.*

/** Check initialization safety of static objects
*
Expand Down
18 changes: 0 additions & 18 deletions tests/init-global/neg/TypeCast.scala

This file was deleted.

22 changes: 22 additions & 0 deletions tests/init-global/warn/ScalaCheck.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
trait CmdLineParser:
outer =>

val a: String

trait Opt[+T]:
val default: T
val names: Set[String]
val help: String

trait IntOpt extends Opt[Int]:
println("outer = " + outer)
println("outer.a = " + outer.a)

object FirstParser extends CmdLineParser:
object OptMinSuccess extends IntOpt: // warn
val default = 100
val names = Set("bla")
val help = "bla"

val opts = List(OptMinSuccess)
val a = "FirstParser"

0 comments on commit 4bd3369

Please sign in to comment.