LetImplementInterfaceFix: cleanup code
This commit is contained in:
@@ -34,9 +34,9 @@ import org.jetbrains.kotlin.types.TypeUtils
|
|||||||
import org.jetbrains.kotlin.types.typeUtil.isInterface
|
import org.jetbrains.kotlin.types.typeUtil.isInterface
|
||||||
|
|
||||||
class LetImplementInterfaceFix(
|
class LetImplementInterfaceFix(
|
||||||
element: KtClassOrObject,
|
element: KtClassOrObject,
|
||||||
expectedType: KotlinType,
|
expectedType: KotlinType,
|
||||||
expressionType: KotlinType
|
expressionType: KotlinType
|
||||||
) : KotlinQuickFixAction<KtClassOrObject>(element), LowPriorityAction {
|
) : KotlinQuickFixAction<KtClassOrObject>(element), LowPriorityAction {
|
||||||
|
|
||||||
private fun KotlinType.renderShort() = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.renderType(this)
|
private fun KotlinType.renderShort() = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.renderType(this)
|
||||||
@@ -47,10 +47,10 @@ class LetImplementInterfaceFix(
|
|||||||
|
|
||||||
private val prefix: String
|
private val prefix: String
|
||||||
|
|
||||||
private val validExpectedType = with (expectedType) {
|
private val validExpectedType = with(expectedType) {
|
||||||
isInterface() &&
|
isInterface() &&
|
||||||
!containsStarProjections() &&
|
!containsStarProjections() &&
|
||||||
constructor !in TypeUtils.getAllSupertypes(expressionType).map(KotlinType::constructor)
|
constructor !in TypeUtils.getAllSupertypes(expressionType).map(KotlinType::constructor)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
Reference in New Issue
Block a user