NI: Do not use asConstraintSystemCompleterContext before completion
This commit is contained in:
+7
-9
@@ -117,7 +117,7 @@ object CollectTypeVariableUsagesInfo : ResolutionStage() {
|
|||||||
|
|
||||||
return dependentTypeParameters.any { (typeParameter, _) ->
|
return dependentTypeParameters.any { (typeParameter, _) ->
|
||||||
returnType.contains {
|
returnType.contains {
|
||||||
it.typeConstructor(asConstraintSystemCompleterContext()) == getTypeParameterByVariable(typeParameter) && !it.isMarkedNullable()
|
it.typeConstructor(this) == getTypeParameterByVariable(typeParameter) && !it.isMarkedNullable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ object CollectTypeVariableUsagesInfo : ResolutionStage() {
|
|||||||
private fun NewConstraintSystemImpl.getDependentTypeParameters(
|
private fun NewConstraintSystemImpl.getDependentTypeParameters(
|
||||||
variable: TypeConstructorMarker,
|
variable: TypeConstructorMarker,
|
||||||
dependentTypeParametersSeen: List<Pair<TypeConstructorMarker, ConeKotlinType?>> = listOf()
|
dependentTypeParametersSeen: List<Pair<TypeConstructorMarker, ConeKotlinType?>> = listOf()
|
||||||
): List<Pair<ConeTypeVariableTypeConstructor, ConeKotlinType?>> = with(asConstraintSystemCompleterContext()) {
|
): List<Pair<ConeTypeVariableTypeConstructor, ConeKotlinType?>> {
|
||||||
val dependentTypeParameters = getBuilder().currentStorage().notFixedTypeVariables.asSequence()
|
val dependentTypeParameters = getBuilder().currentStorage().notFixedTypeVariables.asSequence()
|
||||||
.flatMap { (typeConstructor, constraints) ->
|
.flatMap { (typeConstructor, constraints) ->
|
||||||
require(typeConstructor is ConeTypeVariableTypeConstructor)
|
require(typeConstructor is ConeTypeVariableTypeConstructor)
|
||||||
@@ -170,13 +170,11 @@ object CollectTypeVariableUsagesInfo : ResolutionStage() {
|
|||||||
(getBuilder().currentStorage().allTypeVariables[typeConstructor] as? ConeTypeParameterBasedTypeVariable)?.typeParameterSymbol?.toLookupTag()
|
(getBuilder().currentStorage().allTypeVariables[typeConstructor] as? ConeTypeParameterBasedTypeVariable)?.typeParameterSymbol?.toLookupTag()
|
||||||
|
|
||||||
private fun NewConstraintSystemImpl.getDependingOnTypeParameter(variable: TypeConstructorMarker): List<ConeTypeVariableTypeConstructor> =
|
private fun NewConstraintSystemImpl.getDependingOnTypeParameter(variable: TypeConstructorMarker): List<ConeTypeVariableTypeConstructor> =
|
||||||
with(asConstraintSystemCompleterContext()) {
|
getBuilder().currentStorage().notFixedTypeVariables[variable]?.constraints?.mapNotNull {
|
||||||
getBuilder().currentStorage().notFixedTypeVariables[variable]?.constraints?.mapNotNull {
|
if (it.position.from is ConeDeclaredUpperBoundConstraintPosition && it.kind == ConstraintKind.UPPER) {
|
||||||
if (it.position.from is ConeDeclaredUpperBoundConstraintPosition && it.kind == ConstraintKind.UPPER) {
|
it.type.typeConstructor() as? ConeTypeVariableTypeConstructor
|
||||||
it.type.typeConstructor() as? ConeTypeVariableTypeConstructor
|
} else null
|
||||||
} else null
|
} ?: emptyList()
|
||||||
} ?: emptyList()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun ConeTypeVariable.recordInfoAboutTypeVariableUsagesAsInvariantOrContravariantParameter() {
|
private fun ConeTypeVariable.recordInfoAboutTypeVariableUsagesAsInvariantOrContravariantParameter() {
|
||||||
this.typeConstructor.recordInfoAboutTypeVariableUsagesAsInvariantOrContravariantParameter()
|
this.typeConstructor.recordInfoAboutTypeVariableUsagesAsInvariantOrContravariantParameter()
|
||||||
|
|||||||
+1
-1
@@ -193,7 +193,7 @@ class FirCallCompleter(
|
|||||||
val csBuilder = candidate.system.getBuilder()
|
val csBuilder = candidate.system.getBuilder()
|
||||||
csBuilder.registerVariable(returnVariable)
|
csBuilder.registerVariable(returnVariable)
|
||||||
val functionalType = csBuilder.buildCurrentSubstitutor()
|
val functionalType = csBuilder.buildCurrentSubstitutor()
|
||||||
.safeSubstitute(csBuilder.asConstraintSystemCompleterContext(), atom.expectedType!!) as ConeClassLikeType
|
.safeSubstitute(csBuilder, atom.expectedType!!) as ConeClassLikeType
|
||||||
val size = functionalType.typeArguments.size
|
val size = functionalType.typeArguments.size
|
||||||
val expectedType = ConeClassLikeTypeImpl(
|
val expectedType = ConeClassLikeTypeImpl(
|
||||||
functionalType.lookupTag,
|
functionalType.lookupTag,
|
||||||
|
|||||||
Reference in New Issue
Block a user