Skip to content

Commit b9e8f09

Browse files
committed
Update SA1118 for static anonymous functions
1 parent b83db70 commit b9e8f09

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/ReadabilityRules/SA1118CSharp9UnitTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,33 @@ public void MyCallingFunction(int index, MyObject myObject)
108108
TestCode = testCode,
109109
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
110110
}
111+
112+
[Fact]
113+
[WorkItem(3973, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3973")]
114+
public async Task TestStaticLambdaSpanningMultipleLinesAsync()
115+
{
116+
var testCode = @"using System;
117+
118+
class TestClass
119+
{
120+
public void TestMethod()
121+
{
122+
UseValues(
123+
1,
124+
static (int x, int y) =>
125+
{
126+
return x + y;
127+
},
128+
3);
129+
}
130+
131+
private void UseValues(int first, Func<int, int, int> combine, int last)
132+
{
133+
}
134+
}
135+
";
136+
137+
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
138+
}
111139
}
112140
}

0 commit comments

Comments
 (0)