Skip to content

Commit

Permalink
Separate object init tests from class init tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun committed Apr 6, 2023
1 parent 74b629f commit 9644cf5
Show file tree
Hide file tree
Showing 59 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ class CompilationTests {
compileFilesInDir("tests/explicit-nulls/run", explicitNullsOptions)
}.checkRuns()

// initialization tests
@Test def checkInitGlobal: Unit = {
implicit val testGroup: TestGroup = TestGroup("checkInitGlobal")
val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings")
compileFilesInDir("tests/init-global/neg", options).checkExpectedErrors()
compileFilesInDir("tests/init-global/pos", options).checkCompile()
}

// initialization tests
@Test def checkInit: Unit = {
implicit val testGroup: TestGroup = TestGroup("checkInit")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/init/neg/i12544.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enum Enum:
def g(b: Enum.B): Int = b.foo()

object Enum:
object nested: // error
object nested:
val a: Enum = Case

val b: Enum = f(nested.a)
Expand Down
12 changes: 12 additions & 0 deletions tests/init/pos/i12544.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
enum Enum:
case Case

object Enum:
object nested:
val a: Enum = Case

val b: Enum = f(nested.a)

def f(e: Enum): Enum = e

@main def main(): Unit = println(Enum.b)

0 comments on commit 9644cf5

Please sign in to comment.