[FIR] Fix false positive RETURN_TYPE_MISMATCH in intellij ultimate

This commit is contained in:
Ivan Kochurkin
2022-04-07 16:07:11 +03:00
parent 04da0ba55d
commit 81b1ed9ad4
9 changed files with 14 additions and 11 deletions
@@ -37,7 +37,7 @@ fun errorWithLambda(): String {
return@foo
} foo {
bar()
return@foo <!RETURN_TYPE_MISMATCH!>10<!>
return@foo 10
}
return ""
@@ -25,9 +25,7 @@ object FirFunctionReturnTypeMismatchChecker : FirReturnExpressionChecker() {
override fun check(expression: FirReturnExpression, context: CheckerContext, reporter: DiagnosticReporter) {
if (expression.source == null) return
val targetElement = expression.target.labeledElement
if (targetElement is FirErrorFunction ||
targetElement is FirAnonymousFunction && targetElement.isLambda && expression.target.labelName == null
) {
if (targetElement is FirErrorFunction || targetElement is FirAnonymousFunction && targetElement.isLambda) {
return
}
val resultExpression = expression.result