Add call to type variable and mapping descriptor -> variable
Since type parameter descriptor represents a single declaration of a type parameter, multiple variables in one system may correspond to one type parameter (e.g. in case of nested calls). Hence it's not possible to map type parameters uniquely onto type variables and additional information is required
This commit is contained in:
@@ -20,6 +20,7 @@ package org.jetbrains.kotlin.idea.util
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.CallHandle
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind
|
||||
import org.jetbrains.kotlin.types.*
|
||||
@@ -115,7 +116,7 @@ class FuzzyType(
|
||||
}
|
||||
|
||||
val builder = ConstraintSystemBuilderImpl()
|
||||
val typeVariableSubstitutor = builder.registerTypeVariables(freeParameters + otherType.freeParameters)
|
||||
val typeVariableSubstitutor = builder.registerTypeVariables(CallHandle.NONE, freeParameters + otherType.freeParameters)
|
||||
|
||||
when (matchKind) {
|
||||
MatchKind.IS_SUBTYPE -> builder.addSubtypeConstraint(
|
||||
|
||||
@@ -87,7 +87,8 @@ public class AddGenericUpperBoundFix(
|
||||
typeParameterDescriptor ->
|
||||
|
||||
if (ConstraintsUtil.checkUpperBoundIsSatisfied(
|
||||
successfulConstraintSystem, typeParameterDescriptor, /* substituteOtherTypeParametersInBound */ true
|
||||
successfulConstraintSystem, typeParameterDescriptor, inferenceData.call,
|
||||
/* substituteOtherTypeParametersInBound */ true
|
||||
)) return@factory null
|
||||
|
||||
val upperBound = typeParameterDescriptor.upperBounds.singleOrNull() ?: return@factory null
|
||||
|
||||
Reference in New Issue
Block a user