Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SA1000 C# 9.0 Target-typed New Expression Spacing #3399

Closed
tscafeFigo opened this issue Nov 9, 2021 · 1 comment
Closed

SA1000 C# 9.0 Target-typed New Expression Spacing #3399

tscafeFigo opened this issue Nov 9, 2021 · 1 comment

Comments

@tscafeFigo
Copy link

tscafeFigo commented Nov 9, 2021

C# 9.0 has the ability to not require type specification for constructors when the type is known.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/target-typed-new

Currently SA1000 requires a space after the word new.

This new feature should not require spacing and should be added to the following excerpt.
The new keyword is part of a generic type constraint. In this case there should be no space between the new keyword and the opening parenthesis.

https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1000.md#rule-description

Expected Foo foo = new()
Actual Foo foo = new ()

@sharwell
Copy link
Member

Duplicate of #3214

@sharwell sharwell marked this as a duplicate of #3214 Nov 10, 2021
@sharwell sharwell closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants