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

Give a specific error when a file type is duplicated in the same file #63829

Merged
merged 5 commits into from
Sep 12, 2022

Conversation

RikkiGibson
Copy link
Contributor

Closes #62333

diagnostics.Add(ErrorCode.ERR_DuplicateNameInNS, declaration.Declarations[i].NameLocation, this.Name, this.ContainingSymbol);
// note: a declaration with the 'file' modifier will only be grouped with declarations in the same file.
diagnostics.Add((result & DeclarationModifiers.File) != 0
? ErrorCode.ERR_FileLocalDuplicateNameInNS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we testing this case? (It looks like the cases where we test the new error do not involve partial types.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly there are existing tests for partial in the same file and different files. Duplication_06 changed, but mostly I think the baselines didn't change because the missing partial error takes priority over other duplication errors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I asked because I was looking at commit 1 where Duplication_06 was still referencing the original ErrorCode.

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commit 3)

@RikkiGibson RikkiGibson enabled auto-merge (squash) September 8, 2022 20:08
@RikkiGibson RikkiGibson merged commit fe7ec1e into dotnet:main Sep 12, 2022
@ghost ghost added this to the Next milestone Sep 12, 2022
@RikkiGibson RikkiGibson deleted the file-type-duplicate-error branch September 12, 2022 17:16
@Cosifne Cosifne modified the milestones: Next, 17.4 P3 Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Give a more specific diagnostic when file type collides with non-file type in same file
4 participants