Don't do new captured type specific checks for old ones in the type checker
^KT-47143 Fixed
This commit is contained in:
@@ -376,8 +376,9 @@ object AbstractTypeChecker {
|
||||
): Boolean {
|
||||
val simpleSubArgumentType = subArgumentType.asSimpleType()
|
||||
|
||||
if (simpleSubArgumentType !is CapturedTypeMarker || !simpleSubArgumentType.typeConstructor().projection().isStarProjection())
|
||||
return false
|
||||
if (simpleSubArgumentType !is CapturedTypeMarker || simpleSubArgumentType.isOldCapturedType()
|
||||
|| !simpleSubArgumentType.typeConstructor().projection().isStarProjection()
|
||||
) return false
|
||||
// Only 'for subtyping' captured types are approximated before adding constraints (see ConstraintInjector.addNewIncorporatedConstraint)
|
||||
// that can lead to adding problematic constraints like UPPER(Nothing) given by CapturedType(*) <: TypeVariable(A)
|
||||
if (simpleSubArgumentType.captureStatus() != CaptureStatus.FOR_SUBTYPING) return false
|
||||
|
||||
@@ -285,6 +285,7 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
||||
fun SimpleTypeMarker.typeConstructor(): TypeConstructorMarker
|
||||
fun KotlinTypeMarker.withNullability(nullable: Boolean): KotlinTypeMarker
|
||||
|
||||
fun CapturedTypeMarker.isOldCapturedType(): Boolean
|
||||
fun CapturedTypeMarker.typeConstructor(): CapturedTypeConstructorMarker
|
||||
fun CapturedTypeMarker.captureStatus(): CaptureStatus
|
||||
fun CapturedTypeMarker.isProjectionNotNull(): Boolean
|
||||
|
||||
Reference in New Issue
Block a user