Add codegen tests for local classes/objects declated in class initializers or class parameter initializers
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class A {
|
||||
var a: String = "Fail"
|
||||
|
||||
{
|
||||
a = object {
|
||||
fun toString(): String = "OK"
|
||||
}.toString()
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
return A().a
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A(
|
||||
val a: String = object {
|
||||
fun toString(): String = "OK"
|
||||
}.toString()
|
||||
)
|
||||
|
||||
fun box() : String {
|
||||
return A().a
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
class A {
|
||||
var a: String = "Fail"
|
||||
|
||||
{
|
||||
open class B() {
|
||||
open fun s() : String = "O"
|
||||
}
|
||||
|
||||
object O: B() {
|
||||
override fun s(): String = "K"
|
||||
}
|
||||
|
||||
a = B().s() + O.s()
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
return A().a
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class A(
|
||||
val a: String = {
|
||||
open class B() {
|
||||
open fun s() : String = "O"
|
||||
}
|
||||
|
||||
object O: B() {
|
||||
override fun s(): String = "K"
|
||||
}
|
||||
|
||||
B().s() + O.s()
|
||||
}()
|
||||
)
|
||||
|
||||
fun box() : String {
|
||||
return A().a
|
||||
}
|
||||
@@ -3235,6 +3235,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/box/localClasses"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInInitializer.kt")
|
||||
public void testAnonymousObjectInInitializer() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/localClasses/anonymousObjectInInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInParameterInitializer.kt")
|
||||
public void testAnonymousObjectInParameterInitializer() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/localClasses/anonymousObjectInParameterInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/localClasses/enum.kt");
|
||||
@@ -3290,6 +3300,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest("compiler/testData/codegen/box/localClasses/localClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localClassInInitializer.kt")
|
||||
public void testLocalClassInInitializer() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/localClasses/localClassInInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localClassInParameterInitializer.kt")
|
||||
public void testLocalClassInParameterInitializer() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/localClasses/localClassInParameterInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noclosure.kt")
|
||||
public void testNoclosure() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/localClasses/noclosure.kt");
|
||||
|
||||
Reference in New Issue
Block a user