Test code generation for enum deriving from a trait

This commit is contained in:
Pavel V. Talanov
2014-10-10 17:42:30 +04:00
parent c04b52561e
commit bb5998048f
4 changed files with 42 additions and 0 deletions
@@ -0,0 +1,16 @@
package test
fun box() = MyEnum.E1.f() + MyEnum.E2.f()
enum class MyEnum : T {
E1 {
override fun f() = "O"
}
E2 {
override fun f() = "K"
}
}
trait T {
fun f(): String
}
@@ -2649,6 +2649,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("enumInheritedFromTrait.kt")
public void testEnumInheritedFromTrait() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/enumInheritedFromTrait.kt");
doTest(fileName);
}
@TestMetadata("inPackage.kt")
public void testInPackage() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/inPackage.kt");
@@ -38,4 +38,8 @@ public class EnumTest extends SingleFileTranslationTest {
public void testAccessing() throws Exception {
checkFooBoxIsOk();
}
public void testEnumInheritedFromTrait() throws Exception {
checkFooBoxIsOk();
}
}
@@ -0,0 +1,16 @@
package foo
fun box() = MyEnum.E1.f() + MyEnum.E2.f()
enum class MyEnum : T {
E1 {
override fun f() = "O"
}
E2 {
override fun f() = "K"
}
}
trait T {
fun f(): String
}