KT-2948 Assertion fails on a local enum
#KT-2948 Fixed
This commit is contained in:
+4
-1
@@ -91,13 +91,16 @@ public abstract class MutableClassDescriptorLite extends ClassDescriptorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isStatic(ClassDescriptor declarationClassDescriptor) {
|
private static boolean isStatic(ClassDescriptor declarationClassDescriptor) {
|
||||||
|
if (declarationClassDescriptor.getKind() == ClassKind.ENUM_CLASS) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
DeclarationDescriptor containingDescriptor = declarationClassDescriptor.getContainingDeclaration();
|
DeclarationDescriptor containingDescriptor = declarationClassDescriptor.getContainingDeclaration();
|
||||||
if (containingDescriptor instanceof NamespaceDescriptor) {
|
if (containingDescriptor instanceof NamespaceDescriptor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (containingDescriptor instanceof ClassDescriptor) {
|
else if (containingDescriptor instanceof ClassDescriptor) {
|
||||||
ClassDescriptor containingClassDescriptor = (ClassDescriptor) containingDescriptor;
|
ClassDescriptor containingClassDescriptor = (ClassDescriptor) containingDescriptor;
|
||||||
return containingClassDescriptor.getKind().isObject() || declarationClassDescriptor.getKind() == ClassKind.ENUM_CLASS;
|
return containingClassDescriptor.getKind().isObject();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// KT-2948 Assertion fails on a local enum
|
||||||
|
|
||||||
|
fun foo(): String {
|
||||||
|
enum class E {
|
||||||
|
OK
|
||||||
|
}
|
||||||
|
|
||||||
|
return E.OK.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = foo()
|
||||||
@@ -164,6 +164,10 @@ public class EnumGenTest extends CodegenTestCase {
|
|||||||
blackBoxFile("enum/inner.kt");
|
blackBoxFile("enum/inner.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testInFunction() {
|
||||||
|
blackBoxFile("enum/inFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
public void testInnerWithExistingClassObject() {
|
public void testInnerWithExistingClassObject() {
|
||||||
blackBoxFile("enum/innerWithExistingClassObject.kt");
|
blackBoxFile("enum/innerWithExistingClassObject.kt");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user