-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Include file-local name prefix in names of explicit interface implementations #68331
Conversation
b3c9dfa
to
8f28ed7
Compare
…ferent file-local interfaces with same source name
@dotnet/roslyn-compiler for review of a fairly small bug fix |
} | ||
"""; | ||
|
||
var verifier = CompileAndVerify(new[] { (source0, "F0.cs"), (source1, "F1.cs"), (source2, "F2.cs") }, verify: Verification.Skipped, expectedOutput: "12"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ILVerify incorrectly believes duplicate members are present in the tests where the code is executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you produce an IL/ildasm example for this? How is it possible given our current naming convention for file-types?
If we can confirm this is an ILVerify issue, then we should file an issue on the runtime repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue is the name+parameter list of each member is exactly the same.
Perhaps somewhere along the way the member should be adjusted to prefix with the metadata name of the file type, instead of its source name.
FWIW, I think these members are still distinct at runtime. But it's possible that some tools which operate on IL could be confused by it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 2) with a minor test question
@dotnet/roslyn-compiler for second review. Thanks |
I'll try and see if I can resolve the duplicate member issue the verifier is complaining about. If it's not too difficult, I will update this PR to just do it. |
src/Compilers/CSharp/Test/Symbol/Symbols/Source/FileModifierTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #68331 (comment)
Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "IFoo").WithArguments("Foo", "IFoo.Bar").WithLocation(6, 30), | ||
// F2.cs(9,14): error CS0102: The type 'Foo' already contains a definition for '<F2>F141A34209AF0D3C8CA844A7D9A360C895EB14E557F17D27626C519D9BE96AF4A__IFoo.Bar' | ||
// int IFoo.Bar => 2; | ||
Diagnostic(ErrorCode.ERR_DuplicateNameInClass, "Bar").WithArguments("Foo", "<F2>F141A34209AF0D3C8CA844A7D9A360C895EB14E557F17D27626C519D9BE96AF4A__IFoo.Bar").WithLocation(9, 14)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not ideal to expose the file type's metadata name in an error message, but it's also not a big problem.
If we decide on some way in the future to produce smaller/simpler mangled names for these types, it would improve things here among other places. For example, it's not easy to skim such type names when looking through an ETL trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 3)
@jcouv For the second review |
public void PartialExplicitImplementation_04() | ||
{ | ||
var source1 = """ | ||
file interface IFoo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some "Foo" left here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review pass (iteration 3). Only minor naming issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review (iteration 4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 5)
Closes #68219