Create class from usage fix: enum entries are created with new constructor syntax

This commit is contained in:
Mikhail Glukhikh
2015-08-06 19:55:40 +03:00
parent fe716d7e56
commit 076ac4f5ee
2 changed files with 2 additions and 2 deletions
@@ -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 ""
@@ -5,6 +5,6 @@ package p
fun foo() = X.A
enum class X(n: Int) {
A : X()
A()
}