diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt index 3fac3b10d5c..1f218983370 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt @@ -21,7 +21,8 @@ class ResultTypeWithNullableOperatorsChecker : CallChecker { when { operationNode?.elementType == KtTokens.SAFE_ACCESS -> { - val receiver = resolvedCall.resultingDescriptor.dispatchReceiverParameter ?: return + val resultingDescriptor = resolvedCall.resultingDescriptor + val receiver = resultingDescriptor.extensionReceiverParameter ?: resultingDescriptor.dispatchReceiverParameter ?: return if (receiver.type.isResultType()) { context.trace.report(Errors.RESULT_CLASS_WITH_NULLABLE_OPERATOR.on(operationNode!!.psi, "?.")) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt index bbd5a0b0639..2528c9c30db 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt @@ -22,6 +22,7 @@ fun nullableOperators(r1: Result?, b: Boolean) { if (b) { r1?.toString() + r1?.let { } returnInt()?.intResult?.toString() asFun()?.toString() id(r1)?.toString()