diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt index 38ad8090c1d..04b3dc303e3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt @@ -277,10 +277,6 @@ internal class DelegatingDataFlowInfo private constructor( newTypeInfo.putAll(key, myTypeInfo[key].intersect(otherTypeInfo[key])) } - if (nullabilityMapBuilder.isEmpty() && newTypeInfo.isEmpty) { - return DataFlowInfo.EMPTY - } - return create(null, ImmutableMap.copyOf(nullabilityMapBuilder), newTypeInfo) } @@ -300,7 +296,7 @@ internal class DelegatingDataFlowInfo private constructor( // NB: typeInfo must be mutable here! typeInfo: SetMultimap, valueWithGivenTypeInfo: DataFlowValue? = null - ): DelegatingDataFlowInfo { + ): DataFlowInfo { for (value in typeInfo.keys()) { var iterator = typeInfo[value].iterator() while (iterator.hasNext()) { @@ -311,6 +307,9 @@ internal class DelegatingDataFlowInfo private constructor( } } } + if (nullabilityInfo.isEmpty() && typeInfo.isEmpty && valueWithGivenTypeInfo == null) { + return parent ?: DataFlowInfoFactory.EMPTY + } return DelegatingDataFlowInfo(parent, nullabilityInfo, typeInfo, valueWithGivenTypeInfo) } }