IR: Fix StackOverflowError caused by using DNN type in lambda

^KT-54140 Fixed
This commit is contained in:
Denis.Zharkov
2023-02-02 13:02:45 +01:00
committed by Space Team
parent c586d7a03a
commit 6d7096b5e9
14 changed files with 92 additions and 4 deletions
@@ -1150,7 +1150,9 @@ fun IrType.toIrBasedKotlinType(): KotlinType = when (this) {
is IrSimpleType ->
makeKotlinType(classifier, arguments, isMarkedNullable()).let {
if (classifier is IrTypeParameterSymbol && nullability == SimpleTypeNullability.DEFINITELY_NOT_NULL) {
DefinitelyNotNullType.makeDefinitelyNotNull(it.unwrap()) ?: it
// avoidCheckingActualTypeNullability = true is necessary because in recursive cases `makesSenseToBeDefinitelyNotNull` triggers
// supertype computation for a type parameter and for which bounds we need to call `toIrBasedKotlinType` again
DefinitelyNotNullType.makeDefinitelyNotNull(it.unwrap(), avoidCheckingActualTypeNullability = true) ?: it
} else {
it
}