diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java index 87d10554c36..28e9841d690 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java @@ -175,6 +175,9 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito scope, context.dataFlowInfo, context.trace, /* needCompleteAnalysis = */ true); ModifiersChecker.create(context.trace).checkModifiersForLocalDeclaration(function, functionDescriptor); + if (!function.hasBody()) { + context.trace.report(NON_MEMBER_FUNCTION_NO_BODY.on(function, functionDescriptor)); + } return DataFlowUtils.checkStatementType(function, context, context.dataFlowInfo); } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2334.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2334.kt new file mode 100644 index 00000000000..4801d17d73f --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2334.kt @@ -0,0 +1,5 @@ +//KT-2334 An error 'local function without body' is not reported + +fun foo() { + fun bar() +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 789dbd81b1e..e45860f977b 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -1325,6 +1325,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.kt"); } + @TestMetadata("kt2334.kt") + public void testKt2334() throws Exception { + doTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2334.kt"); + } + @TestMetadata("kt2369.kt") public void testKt2369() throws Exception { doTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2369.kt");