@@ -205,7 +205,7 @@ public void TestMethod()
205205 }
206206
207207 [ Fact ]
208- public async Task ElseClauseWithOnlyReturnShouldTrigger ( )
208+ public async Task ElseClauseWithOnlyReturnShouldNotTrigger ( )
209209 {
210210 var source = """
211211 class TestClass
@@ -223,12 +223,11 @@ public void TestMethod(bool condition)
223223 """ ;
224224
225225 var diagnostics = await GetDiagnosticsAsync ( source ) ;
226- Assert . Single ( diagnostics ) ;
227- Assert . Equal ( "CT0004" , diagnostics [ 0 ] . Id ) ;
226+ Assert . Empty ( diagnostics ) ;
228227 }
229228
230229 [ Fact ]
231- public async Task ElseIfShouldNotTrigger ( )
230+ public async Task IfWithElseIfShouldNotTrigger ( )
232231 {
233232 var source = """
234233 class TestClass
@@ -248,7 +247,7 @@ public void TestMethod(bool condition1, bool condition2)
248247 """ ;
249248
250249 var diagnostics = await GetDiagnosticsAsync ( source ) ;
251- Assert . Equal ( 2 , diagnostics . Length ) ;
250+ Assert . Empty ( diagnostics ) ;
252251 }
253252
254253 [ Fact ]
@@ -291,6 +290,34 @@ public void TestMethod(bool condition)
291290 Assert . Empty ( diagnostics ) ;
292291 }
293292
293+ [ Fact ]
294+ public async Task IfElseWithMultipleStatementsInIfAndSingleControlFlowInElseShouldNotTrigger ( )
295+ {
296+ var source = """
297+ class TestClass
298+ {
299+ public void TestMethod(bool condition)
300+ {
301+ if (condition)
302+ {
303+ DoSomething();
304+ DoSomethingElse();
305+ }
306+ else
307+ {
308+ throw new System.Exception();
309+ }
310+ }
311+
312+ private void DoSomething() { }
313+ private void DoSomethingElse() { }
314+ }
315+ """ ;
316+
317+ var diagnostics = await GetDiagnosticsAsync ( source ) ;
318+ Assert . Empty ( diagnostics ) ;
319+ }
320+
294321 private static async Task < Diagnostic [ ] > GetDiagnosticsAsync ( string source )
295322 {
296323 var syntaxTree = CSharpSyntaxTree . ParseText ( source ) ;
0 commit comments