Do not look into captured star projection as types
This commit is contained in:
+7
-3
@@ -16,9 +16,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls
|
package org.jetbrains.kotlin.resolve.calls
|
||||||
|
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.AbstractNullabilityChecker
|
||||||
import org.jetbrains.kotlin.types.checker.*
|
|
||||||
import org.jetbrains.kotlin.types.AbstractNullabilityChecker.hasPathByNotMarkedNullableNodes
|
import org.jetbrains.kotlin.types.AbstractNullabilityChecker.hasPathByNotMarkedNullableNodes
|
||||||
|
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||||
|
import org.jetbrains.kotlin.types.AbstractTypeCheckerContext
|
||||||
|
import org.jetbrains.kotlin.types.UnwrappedType
|
||||||
|
import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext
|
||||||
import org.jetbrains.kotlin.types.model.*
|
import org.jetbrains.kotlin.types.model.*
|
||||||
|
|
||||||
object NewCommonSuperTypeCalculator {
|
object NewCommonSuperTypeCalculator {
|
||||||
@@ -174,7 +177,8 @@ object NewCommonSuperTypeCalculator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun TypeSystemCommonSuperTypesContext.isCapturedStubType(type: SimpleTypeMarker): Boolean {
|
private fun TypeSystemCommonSuperTypesContext.isCapturedStubType(type: SimpleTypeMarker): Boolean {
|
||||||
val projectedType = type.asCapturedType()?.typeConstructor()?.projection()?.getType() ?: return false
|
val projectedType =
|
||||||
|
type.asCapturedType()?.typeConstructor()?.projection()?.takeUnless { it.isStarProjection() }?.getType() ?: return false
|
||||||
return projectedType.asSimpleType()?.isStubType() == true
|
return projectedType.asSimpleType()?.isStubType() == true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -185,10 +185,12 @@ class NewConstraintSystemImpl(
|
|||||||
val capturedType = it.asSimpleType()?.asCapturedType()
|
val capturedType = it.asSimpleType()?.asCapturedType()
|
||||||
// TODO: change NewCapturedType to markered one for FE-IR
|
// TODO: change NewCapturedType to markered one for FE-IR
|
||||||
val typeToCheck = if (capturedType is CapturedTypeMarker && capturedType.captureStatus() == CaptureStatus.FROM_EXPRESSION)
|
val typeToCheck = if (capturedType is CapturedTypeMarker && capturedType.captureStatus() == CaptureStatus.FROM_EXPRESSION)
|
||||||
capturedType.typeConstructorProjection().getType()
|
capturedType.typeConstructorProjection().takeUnless { projection -> projection.isStarProjection() }?.getType()
|
||||||
else
|
else
|
||||||
it
|
it
|
||||||
|
|
||||||
|
if (typeToCheck == null) return@contains false
|
||||||
|
|
||||||
storage.allTypeVariables.containsKey(typeToCheck.typeConstructor())
|
storage.allTypeVariables.containsKey(typeToCheck.typeConstructor())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,8 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
|||||||
|
|
||||||
fun KotlinTypeMarker.isDynamic(): Boolean = asFlexibleType()?.asDynamicType() != null
|
fun KotlinTypeMarker.isDynamic(): Boolean = asFlexibleType()?.asDynamicType() != null
|
||||||
fun KotlinTypeMarker.isCapturedDynamic(): Boolean =
|
fun KotlinTypeMarker.isCapturedDynamic(): Boolean =
|
||||||
asSimpleType()?.asCapturedType()?.typeConstructor()?.projection()?.getType()?.isDynamic() == true
|
asSimpleType()?.asCapturedType()?.typeConstructor()?.projection()?.takeUnless { it.isStarProjection() }
|
||||||
|
?.getType()?.isDynamic() == true
|
||||||
|
|
||||||
fun KotlinTypeMarker.isDefinitelyNotNullType(): Boolean = asSimpleType()?.asDefinitelyNotNullType() != null
|
fun KotlinTypeMarker.isDefinitelyNotNullType(): Boolean = asSimpleType()?.asDefinitelyNotNullType() != null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user