diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/RedundantJumpStatement.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/RedundantJumpStatement.cs index c51112b8235..8e83e027fc0 100644 --- a/analyzers/tests/SonarAnalyzer.Test/TestCases/RedundantJumpStatement.cs +++ b/analyzers/tests/SonarAnalyzer.Test/TestCases/RedundantJumpStatement.cs @@ -259,4 +259,32 @@ public class Log { public void Finally() { } } + + // https://sonarsource.atlassian.net/browse/NET-1149 + public class Repro_1149 + { + public void Method(List items) + { + items.ForEach(LocalFunction); + + return; // Noncompliant - FP + + void LocalFunction(string item) + { + Console.WriteLine(item); + } + } + public void Method2(List items) + { + void LocalFunction(string item) + { + Console.WriteLine(item); + } + + items.ForEach(LocalFunction); + + return; // Noncompliant + } + } } +