From 93906bad1d5030100d201ee5b248b4b0664613f8 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 22 Jan 2020 14:45:31 +0300 Subject: [PATCH] [FIR] Add workaround about incorrect safe call invoke desugaring #KT-36014 --- .../jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt index a8577013b27..540052ca4d6 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt @@ -531,7 +531,8 @@ abstract class FirDataFlowAnalyzer( val node = graphBuilder.exitSafeCall(qualifiedAccess).mergeIncomingFlow() val variable = variableStorage.getOrCreateVariable(qualifiedAccess) val receiverVariable = when (variable) { - is RealVariable -> variable.explicitReceiverVariable!! + // There is some bug with invokes. See KT-36014 + is RealVariable -> variable.explicitReceiverVariable ?: return is SyntheticVariable -> variableStorage.getOrCreateVariable(qualifiedAccess.explicitReceiver!!) } logicSystem.addImplication(node.flow, (variable notEq null) implies (receiverVariable notEq null))