diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeIntersector.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeIntersector.kt index b5a01ebe7cc..fb7f533aac9 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeIntersector.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeIntersector.kt @@ -17,8 +17,15 @@ object ConeTypeIntersector { 1 -> return types.single() } - val inputTypes = mutableListOf() - flatIntersectionTypes(types, inputTypes) + val inputTypes = mutableListOf().apply { + for (inputType in types) { + if (inputType is ConeIntersectionType) { + addAll(inputType.intersectedTypes) + } else { + add(inputType) + } + } + } /** * resultNullability. Value description: @@ -85,21 +92,6 @@ object ConeTypeIntersector { } } - private fun flatIntersectionTypes( - inputTypes: List, - typeCollector: MutableList - ) { - for (inputType in inputTypes) { - if (inputType is ConeIntersectionType) { - for (type in inputType.intersectedTypes) { - typeCollector += type - } - } else { - typeCollector += inputType - } - } - } - private fun ConeKotlinType.isStrictSubtypeOf(context: ConeTypeContext, supertype: ConeKotlinType): Boolean = AbstractTypeChecker.isSubtypeOf(context, this, supertype) && !AbstractTypeChecker.isSubtypeOf(context, supertype, this)