File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
StyleCop.Analyzers.Test.CSharp9/ReadabilityRules
StyleCop.Analyzers/ReadabilityRules Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -75,5 +75,37 @@ r with
7575 TestCode = testCode ,
7676 } . RunAsync ( CancellationToken . None ) . ConfigureAwait ( false ) ;
7777 }
78+
79+ [ Fact ]
80+ [ WorkItem ( 3339 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3339" ) ]
81+ public async Task TestNewExpressionAsync ( )
82+ {
83+ var testCode = @"
84+ public class MyClass
85+ {
86+ public class MyObject
87+ {
88+ public string MyValue { get; init; }
89+ }
90+
91+ public void MyTestFunction()
92+ {
93+ MyCallingFunction(0, new()
94+ {
95+ MyValue = ""Test""
96+ });
97+ }
98+
99+ public void MyCallingFunction(int index, MyObject myObject)
100+ {
101+ }
102+ }" ;
103+
104+ await new CSharpTest ( LanguageVersion . CSharp9 )
105+ {
106+ ReferenceAssemblies = ReferenceAssemblies . Net . Net50 ,
107+ TestCode = testCode ,
108+ } . RunAsync ( CancellationToken . None ) . ConfigureAwait ( false ) ;
109+ }
78110 }
79111}
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ internal class SA1118ParameterMustNotSpanMultipleLines : DiagnosticAnalyzer
8484 SyntaxKind . ArrayCreationExpression ,
8585 SyntaxKind . ImplicitArrayCreationExpression ,
8686 SyntaxKindEx . WithExpression ,
87+ SyntaxKindEx . ImplicitObjectCreationExpression ,
8788 } ;
8889
8990 /// <inheritdoc/>
You can’t perform that action at this time.
0 commit comments