FIR: support star projection in CreateFreshTypeVariableSubstitutorStage
This commit fixes a small pack of tests failing at this point
This commit is contained in:
committed by
Mikhail Glukhikh
parent
4bcba000fd
commit
c06d521e78
+16
-7
@@ -7,9 +7,14 @@ package org.jetbrains.kotlin.fir.resolve.calls
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirCallableMemberDeclaration
|
import org.jetbrains.kotlin.fir.declarations.FirCallableMemberDeclaration
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||||
|
import org.jetbrains.kotlin.fir.renderWithType
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.constructType
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutorByMap
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutorByMap
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.firUnsafe
|
import org.jetbrains.kotlin.fir.resolve.transformers.firUnsafe
|
||||||
|
import org.jetbrains.kotlin.fir.service
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.invoke
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.types.impl.FirTypePlaceholderProjection
|
import org.jetbrains.kotlin.fir.types.impl.FirTypePlaceholderProjection
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemOperation
|
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemOperation
|
||||||
@@ -58,17 +63,21 @@ internal object CreateFreshTypeVariableSubstitutorStage : ResolutionStage() {
|
|||||||
val typeArgument =
|
val typeArgument =
|
||||||
callInfo.typeArguments.getOrElse(index) { FirTypePlaceholderProjection }//resolvedCall.typeArgumentMappingByOriginal.getTypeArgument(typeParameter)
|
callInfo.typeArguments.getOrElse(index) { FirTypePlaceholderProjection }//resolvedCall.typeArgumentMappingByOriginal.getTypeArgument(typeParameter)
|
||||||
//
|
//
|
||||||
if (typeArgument is FirTypeProjectionWithVariance) {
|
when (typeArgument) {
|
||||||
csBuilder.addEqualityConstraint(
|
is FirTypeProjectionWithVariance -> csBuilder.addEqualityConstraint(
|
||||||
freshVariable.defaultType,
|
freshVariable.defaultType,
|
||||||
typeArgument.typeRef.coneTypeUnsafe(),
|
typeArgument.typeRef.coneTypeUnsafe(),
|
||||||
SimpleConstraintSystemConstraintPosition // TODO
|
SimpleConstraintSystemConstraintPosition // TODO
|
||||||
)
|
)
|
||||||
} else {
|
is FirStarProjection -> csBuilder.addEqualityConstraint(
|
||||||
assert(typeArgument == FirTypePlaceholderProjection) // TODO
|
freshVariable.defaultType,
|
||||||
// assert(typeArgument == TypeArgumentPlaceholder) {
|
typeParameter.bounds.firstOrNull()?.coneTypeUnsafe()
|
||||||
// "Unexpected typeArgument: $typeArgument, ${typeArgument.javaClass.canonicalName}"
|
?: StandardClassIds.Any(sink.components.session.service()).constructType(emptyArray(), true),
|
||||||
// }
|
SimpleConstraintSystemConstraintPosition
|
||||||
|
)
|
||||||
|
else -> assert(typeArgument == FirTypePlaceholderProjection) {
|
||||||
|
"Unexpected typeArgument: ${typeArgument.renderWithType()}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user