KT-2350 fix: enums with overrides and constructor parameters
This commit is contained in:
@@ -1088,7 +1088,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
iv.dup();
|
||||
iv.iconst(ordinal);
|
||||
|
||||
// TODO type and constructor parameters
|
||||
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, enumConstant);
|
||||
String implClass = typeMapper.mapType(classDescriptor.getDefaultType(), MapTypeMode.IMPL).getInternalName();
|
||||
|
||||
@@ -1103,7 +1102,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
iv.aconst(enumConstant.getName());
|
||||
iv.iconst(ordinal);
|
||||
|
||||
if (delegationSpecifiers.size() == 1) {
|
||||
if (delegationSpecifiers.size() == 1 && !state.getInjector().getClosureAnnotator().enumEntryNeedSubclass(enumConstant)) {
|
||||
final JetDelegationSpecifier specifier = delegationSpecifiers.get(0);
|
||||
if (specifier instanceof JetDelegatorToSuperCall) {
|
||||
final JetDelegatorToSuperCall superCall = (JetDelegatorToSuperCall) specifier;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
enum class A(val b: String) {
|
||||
E1: A("OK"){ override fun t() = b }
|
||||
|
||||
abstract fun t(): String
|
||||
}
|
||||
|
||||
fun box()= A.E1.t()
|
||||
@@ -135,4 +135,9 @@ public class EnumGenTest extends CodegenTestCase {
|
||||
public void testKt1119() {
|
||||
blackBoxFile("regressions/kt1119.kt");
|
||||
}
|
||||
|
||||
public void testKt2350() {
|
||||
blackBoxFile("regressions/kt2350.kt");
|
||||
System.out.println(generateToText());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user