Resolution: extract projections from captured flexible type properly
#KT-54100 Fixed Related to KT-54196, KT-54198
This commit is contained in:
committed by
teamcity
parent
8517249776
commit
e9bb0f4fda
+8
-2
@@ -204,9 +204,15 @@ class VariableFixationFinder(
|
||||
inline fun TypeSystemInferenceExtensionContext.isProperTypeForFixation(type: KotlinTypeMarker, isProper: (KotlinTypeMarker) -> Boolean) =
|
||||
isProper(type) && extractProjectionsForAllCapturedTypes(type).all(isProper)
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun TypeSystemInferenceExtensionContext.extractProjectionsForAllCapturedTypes(baseType: KotlinTypeMarker): Set<KotlinTypeMarker> {
|
||||
val simpleBaseType = baseType.asSimpleType()
|
||||
if (baseType.isFlexible()) {
|
||||
val flexibleType = baseType.asFlexibleType()!!
|
||||
return buildSet {
|
||||
addAll(extractProjectionsForAllCapturedTypes(flexibleType.lowerBound()))
|
||||
addAll(extractProjectionsForAllCapturedTypes(flexibleType.upperBound()))
|
||||
}
|
||||
}
|
||||
val simpleBaseType = baseType.asSimpleType()?.originalIfDefinitelyNotNullable()
|
||||
|
||||
return buildSet {
|
||||
val projectionType = if (simpleBaseType is CapturedTypeMarker) {
|
||||
|
||||
+1
-1
@@ -289,7 +289,7 @@ class NewConstraintSystemImpl(
|
||||
private fun isProperTypeImpl(type: KotlinTypeMarker): Boolean =
|
||||
!type.contains {
|
||||
val capturedType = it.asSimpleType()?.asCapturedType()
|
||||
// TODO: change NewCapturedType to markered one for FE-IR
|
||||
|
||||
val typeToCheck = if (capturedType is CapturedTypeMarker && capturedType.captureStatus() == CaptureStatus.FROM_EXPRESSION)
|
||||
capturedType.typeConstructorProjection().takeUnless { projection -> projection.isStarProjection() }?.getType()
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user