[IDE-NI] Fix detecting error types in InsertExplicitTypeArgumentsIntention
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
e46f552a8d
commit
1a085516b0
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.psi.KtTypeArgumentList
|
|||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.CapturedType
|
import org.jetbrains.kotlin.resolve.calls.inference.CapturedType
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.tower.NewResolvedCallImpl
|
||||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||||
import org.jetbrains.kotlin.types.ErrorUtils
|
import org.jetbrains.kotlin.types.ErrorUtils
|
||||||
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||||
@@ -48,6 +49,13 @@ class InsertExplicitTypeArgumentsIntention :
|
|||||||
|
|
||||||
val resolvedCall = element.getResolvedCall(bindingContext) ?: return false
|
val resolvedCall = element.getResolvedCall(bindingContext) ?: return false
|
||||||
val typeArgs = resolvedCall.typeArguments
|
val typeArgs = resolvedCall.typeArguments
|
||||||
|
if (resolvedCall is NewResolvedCallImpl<*>) {
|
||||||
|
val valueParameterTypes = resolvedCall.resultingDescriptor.valueParameters.map { it.type }
|
||||||
|
if (valueParameterTypes.any { ErrorUtils.containsErrorType(it) }) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return typeArgs.isNotEmpty() && typeArgs.values.none { ErrorUtils.containsErrorType(it) || it is CapturedType || it is NewCapturedType }
|
return typeArgs.isNotEmpty() && typeArgs.values.none { ErrorUtils.containsErrorType(it) || it is CapturedType || it is NewCapturedType }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user