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

False positive CS0826 on empty array #59701

Closed
SupinePandora43 opened this issue Feb 23, 2022 · 3 comments
Closed

False positive CS0826 on empty array #59701

SupinePandora43 opened this issue Feb 23, 2022 · 3 comments
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@SupinePandora43
Copy link

Version Used:

Dotnet sdk 6.0.101

Steps to Reproduce:

string[] array = new[]{};

Expected Behavior:

No error

Actual Behavior:

No best type found for implicitly typed array.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 23, 2022
@CyrusNajmabadi
Copy link
Member

I believe this is by design. Your array has no elements. Note, you can just write: string[] s = {};

@RikkiGibson
Copy link
Contributor

It looks like target typing new[] expressions is tracked by dotnet/csharplang/issues/2701.

@CyrusNajmabadi
Copy link
Member

Closing out as not a roslyn issue. Lang change can be tracked at teh linked issue above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

3 participants