Skip to content

Add init test #20356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading