Inline type parameter fix: reformat

This commit is contained in:
Mikhail Glukhikh
2018-01-18 17:17:12 +03:00
parent ee3f89df87
commit 1924172189
@@ -34,7 +34,7 @@ class InlineTypeParameterFix(val typeReference: KtTypeReference) : KotlinQuickFi
val parameterListOwner = typeReference.getStrictParentOfType<KtTypeParameterListOwner>() ?: return val parameterListOwner = typeReference.getStrictParentOfType<KtTypeParameterListOwner>() ?: return
val context = parameterListOwner.analyzeFully() val context = parameterListOwner.analyzeFully()
val parameterDescriptor = context[BindingContext.TYPE_PARAMETER, parameter] ?: return val parameterDescriptor = context[BindingContext.TYPE_PARAMETER, parameter] ?: return
parameterListOwner.forEachDescendantOfType<KtTypeReference>() { parameterListOwner.forEachDescendantOfType<KtTypeReference> {
val typeElement = it.typeElement val typeElement = it.typeElement
val type = context[BindingContext.TYPE, it] val type = context[BindingContext.TYPE, it]
if (typeElement != null && type != null && type.constructor.declarationDescriptor == parameterDescriptor) { if (typeElement != null && type != null && type.constructor.declarationDescriptor == parameterDescriptor) {
@@ -44,8 +44,7 @@ class InlineTypeParameterFix(val typeReference: KtTypeReference) : KotlinQuickFi
if (parameterList.parameters.size == 1) { if (parameterList.parameters.size == 1) {
parameterList.delete() parameterList.delete()
} } else {
else {
EditCommaSeparatedListHelper.removeItem(parameter) EditCommaSeparatedListHelper.removeItem(parameter)
} }
} }