Common supertypes: unwrap captured type from DNN type during recursion control
This commit handles subtle situation when K1 represents flexible type arguments as just T..T?, but K2 does it as T&Any..T?. This can provoke a type like Captured(*)&Any..Captured(*)?, and before this commit we couldn't find recursion inside Captured(*)&Any. This could lead to explosions inside type system and inference errors #KT-60581 Fixed
This commit is contained in:
committed by
Space Team
parent
610a9d9c6a
commit
aea7b8f00a
+2
-2
@@ -421,10 +421,10 @@ object NewCommonSuperTypeCalculator {
|
||||
}
|
||||
|
||||
private fun TypeSystemCommonSuperTypesContext.isCapturedStarProjection(type: SimpleTypeMarker): Boolean =
|
||||
type.asCapturedType()?.typeConstructor()?.projection()?.isStarProjection() == true
|
||||
type.originalIfDefinitelyNotNullable().asCapturedType()?.typeConstructor()?.projection()?.isStarProjection() == true
|
||||
|
||||
private fun TypeSystemCommonSuperTypesContext.supertypesIfCapturedStarProjection(type: SimpleTypeMarker): Collection<KotlinTypeMarker>? {
|
||||
val constructor = type.asCapturedType()?.typeConstructor() ?: return null
|
||||
val constructor = type.originalIfDefinitelyNotNullable().asCapturedType()?.typeConstructor() ?: return null
|
||||
return if (constructor.projection().isStarProjection())
|
||||
constructor.supertypes()
|
||||
else null
|
||||
|
||||
Reference in New Issue
Block a user