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

Check duplicate interfaces only for metadata #73797

Merged
merged 6 commits into from
Jun 17, 2024

Conversation

jjonescz
Copy link
Member

Fixes #40538.
Fixes dotnet/razor#9837.

First commit extracted out of #73730.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels May 31, 2024
@jjonescz jjonescz marked this pull request as ready for review May 31, 2024 14:05
@jjonescz jjonescz requested a review from a team as a code owner May 31, 2024 14:05
@AlekseyTs
Copy link
Contributor

Done with review pass (commit 2)

@jjonescz jjonescz requested review from AlekseyTs and RikkiGibson June 4, 2024 11:40
@AlekseyTs
Copy link
Contributor

Done with review pass (commit 3)

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 4)

@jjonescz
Copy link
Member Author

@RikkiGibson for another look, thanks

public interface I<T> { }
""";

CompileAndVerify(CreateCompilationWithMscorlib40(source), symbolValidator: validate).VerifyDiagnostics();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is interesting to also know what the source symbol does. Is it going to have interface I<T> twice with different nullability?


partial class C1<T> : I<
T,
#nullable disable
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would also be interesting to test when the lexical first declaration has a nullable-disabled type argument

Copy link
Contributor

@RikkiGibson RikkiGibson left a comment

Choose a reason for hiding this comment

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

LGTM except for minor test quibbles. No need to comprehensively change tests to address them, even just one example of each would be great.

@jjonescz jjonescz requested a review from RikkiGibson June 12, 2024 10:11
@jjonescz
Copy link
Member Author

@RikkiGibson for another look, thanks

var interfaces = c.AllInterfacesNoUseSiteDiagnostics;
Assert.Equal(2, interfaces.Length);
AssertEx.Equal("I<T>", interfaces[0].ToTestDisplayString(includeNonNullable: true));
AssertEx.Equal("I<T>", interfaces[1].ToTestDisplayString(includeNonNullable: true));
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that these actually have exactly the same type? If not, consider adjusting the comparison so that the distinction between the two types are clear.

@jjonescz jjonescz requested a review from RikkiGibson June 14, 2024 11:10
@jjonescz jjonescz merged commit b8320e1 into dotnet:main Jun 17, 2024
24 checks passed
@jjonescz jjonescz deleted the 40538-DuplicateSourceInterface branch June 17, 2024 17:21
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 17, 2024
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
3 participants