diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt
index b69a475ecd5..382d7de2a16 100644
--- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt
@@ -43,15 +43,7 @@ class RedundantUnitReturnTypeInspection : AbstractKotlinInspection(), CleanupLoc
val descriptor = context[BindingContext.FUNCTION, function] ?: return
if (descriptor.returnType?.isUnit() == true) {
if (!function.hasBlockBody()) {
- val bodyExpression = function.bodyExpression
- if (bodyExpression != null) {
- val bodyContext = bodyExpression.analyze(BodyResolveMode.PARTIAL)
- if (bodyContext.getType(bodyExpression)?.isNothing() == true) return
- val resolvedCall = bodyExpression.getResolvedCall(bodyContext)
- if (resolvedCall != null) {
- if (resolvedCall.candidateDescriptor.returnType?.isUnit() != true) return
- }
- }
+ return
}
holder.registerProblem(typeElement,
diff --git a/idea/testData/inspections/redundantUnitReturnType/inspectionData/expected.xml b/idea/testData/inspections/redundantUnitReturnType/inspectionData/expected.xml
index 9af9a7d7df3..c0ee719facd 100644
--- a/idea/testData/inspections/redundantUnitReturnType/inspectionData/expected.xml
+++ b/idea/testData/inspections/redundantUnitReturnType/inspectionData/expected.xml
@@ -15,14 +15,6 @@
Redundant 'Unit' return type
Redundant Unit return type
-
- Test.kt
- 8
- light_idea_test_case
-
- Redundant 'Unit' return type
- Redundant Unit return type
-
Test.kt
12
@@ -31,12 +23,4 @@
Redundant 'Unit' return type
Redundant Unit return type
-
- WithLambda.kt
- 11
- light_idea_test_case
-
- Redundant 'Unit' return type
- Redundant 'Unit' return type
-