Rename: ClassKind.TRAIT -> ClassKind.INTERFACE
This commit is contained in:
+1
-1
@@ -487,7 +487,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
||||
val openMod = if (open) "open " else ""
|
||||
val innerMod = if (inner) "inner " else ""
|
||||
val typeParamList = when (kind) {
|
||||
ClassKind.PLAIN_CLASS, ClassKind.TRAIT -> "<>"
|
||||
ClassKind.PLAIN_CLASS, ClassKind.INTERFACE -> "<>"
|
||||
else -> ""
|
||||
}
|
||||
psiFactory.createDeclaration<JetClassOrObject>(
|
||||
|
||||
+2
-2
@@ -38,12 +38,12 @@ public object CreateClassFromTypeReferenceActionFactory : CreateClassFromUsageFa
|
||||
val typeRefParent = element.parent?.parent
|
||||
if (typeRefParent is JetConstructorCalleeExpression) return Collections.emptyList()
|
||||
|
||||
val traitExpected = typeRefParent is JetDelegatorToSuperClass
|
||||
val interfaceExpected = typeRefParent is JetDelegatorToSuperClass
|
||||
|
||||
val isQualifier = (element.parent as? JetUserType)?.let { it.qualifier == element } ?: false
|
||||
|
||||
return when {
|
||||
traitExpected -> Collections.singletonList(ClassKind.TRAIT)
|
||||
interfaceExpected -> Collections.singletonList(ClassKind.INTERFACE)
|
||||
else -> ClassKind.values().filter {
|
||||
val noTypeArguments = element.typeArgumentsAsTypes.isEmpty()
|
||||
when (it) {
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ enum class ClassKind(val keyword: String, val description: String) {
|
||||
ENUM_CLASS("enum class", "enum"),
|
||||
ENUM_ENTRY("", "enum constant"),
|
||||
ANNOTATION_CLASS("annotation class", "annotation"),
|
||||
TRAIT("interface", "interface"),
|
||||
INTERFACE("interface", "interface"),
|
||||
OBJECT("object", "object"),
|
||||
DEFAULT("", "") // Used as a placeholder and must be replaced with one of the kinds above
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class CreateClassFromUsageFix<E : JetElement>(
|
||||
|
||||
val constructorInfo = PrimaryConstructorInfo(classInfo, expectedTypeInfo)
|
||||
val builder = CallableBuilderConfiguration(
|
||||
Collections.singletonList(constructorInfo), element as JetElement, file, editor, false, kind == PLAIN_CLASS || kind == TRAIT
|
||||
Collections.singletonList(constructorInfo), element as JetElement, file, editor, false, kind == PLAIN_CLASS || kind == INTERFACE
|
||||
).createBuilder()
|
||||
builder.placement = CallablePlacement.NoReceiver(targetParent)
|
||||
project.executeCommand(text) { builder.build() }
|
||||
|
||||
+2
-2
@@ -106,8 +106,8 @@ private fun JetExpression.getInheritableTypeInfo(
|
||||
return TypeInfo.ByType(type, Variance.OUT_VARIANCE).noSubstitutions() to { classKind ->
|
||||
when (classKind) {
|
||||
ClassKind.ENUM_ENTRY -> isEnum && containingDeclaration == DescriptorToSourceUtils.descriptorToDeclaration(descriptor)
|
||||
ClassKind.TRAIT -> containingDeclaration !is PsiClass
|
||||
|| (descriptor as? ClassDescriptor)?.getKind() == ClassDescriptorKind.INTERFACE
|
||||
ClassKind.INTERFACE -> containingDeclaration !is PsiClass
|
||||
|| (descriptor as? ClassDescriptor)?.getKind() == ClassDescriptorKind.INTERFACE
|
||||
else -> canHaveSubtypes
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user