Skip to content

Commit 1377c3b

Browse files
committed
Update SA1008 for static anonymous functions
1 parent 74eded3 commit 1377c3b

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/SpacingRules/SA1008CSharp9UnitTests.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,34 @@ public async Task TestDeconstructionInTopLevelProgramAsync(string prefix)
110110
FixedCode = fixedCode,
111111
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
112112
}
113+
114+
[Fact]
115+
[WorkItem(3973, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3973")]
116+
public async Task TestStaticLambdaSpacingAsync()
117+
{
118+
var testCode = @"using System;
119+
120+
public class TestClass
121+
{
122+
public void TestMethod()
123+
{
124+
Func<int, int> identity = static{|#0:(|}int value) => value;
125+
}
126+
}
127+
";
128+
129+
var fixedCode = @"using System;
130+
131+
public class TestClass
132+
{
133+
public void TestMethod()
134+
{
135+
Func<int, int> identity = static (int value) => value;
136+
}
137+
}
138+
";
139+
140+
await VerifyCSharpFixAsync(testCode, Diagnostic(DescriptorPreceded).WithLocation(0), fixedCode, CancellationToken.None).ConfigureAwait(false);
141+
}
113142
}
114143
}

0 commit comments

Comments
 (0)