Create class from usage fix: enum entries are created with new constructor syntax
This commit is contained in:
+1
-1
@@ -481,7 +481,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
||||
ClassKind.ENUM_ENTRY -> {
|
||||
if (!(targetParent is JetClass && targetParent.isEnum())) throw AssertionError("Enum class expected: ${targetParent.getText()}")
|
||||
val hasParameters = targetParent.getPrimaryConstructorParameters().isNotEmpty()
|
||||
psiFactory.createEnumEntry("$name ${if (hasParameters) ": ${targetParent.getName()}()" else ""}")
|
||||
psiFactory.createEnumEntry("$name${if (hasParameters) "()" else " "}")
|
||||
}
|
||||
else -> {
|
||||
val openMod = if (open) "open " else ""
|
||||
|
||||
+1
-1
@@ -5,6 +5,6 @@ package p
|
||||
fun foo() = X.A
|
||||
|
||||
enum class X(n: Int) {
|
||||
A : X()
|
||||
A()
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user