Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,37 @@ r with
TestCode = testCode,
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}

[Fact]
[WorkItem(3339, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3339")]
public async Task TestNewExpressionAsync()
{
var testCode = @"
public class MyClass
{
public class MyObject
{
public string MyValue { get; init; }
}

public void MyTestFunction()
{
MyCallingFunction(0, new()
{
MyValue = ""Test""
});
}

public void MyCallingFunction(int index, MyObject myObject)
{
}
}";

await new CSharpTest(LanguageVersion.CSharp9)
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
TestCode = testCode,
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ internal class SA1118ParameterMustNotSpanMultipleLines : DiagnosticAnalyzer
SyntaxKind.ArrayCreationExpression,
SyntaxKind.ImplicitArrayCreationExpression,
SyntaxKindEx.WithExpression,
SyntaxKindEx.ImplicitObjectCreationExpression,
};

/// <inheritdoc/>
Expand Down