-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Diagnostics for module initializers feature #43301
Diagnostics for module initializers feature #43301
Conversation
The unit of translation is usually a single diagnostic message. We sometimes parameterize based on simple discriminators e.g. saying "type" versus "method", but nothing more complex than that. I'm happy with your preference, so feel free to leave the diagnostics as is :) |
Happy to review whenever this is ready. |
c7c5a81
to
0f3f43a
Compare
@RikkiGibson It's now ready to be reviewed whenever #43281 merges. If you prefer, you could review before that if you want to review by commit and ignore the commits before the first commit for this PR, "Planned diagnostics." |
If this is ready to review, could you please change the base to |
0f3f43a
to
3255afa
Compare
@RikkiGibson Thanks, I hadn't realized I had the wrong base. Rebased and ready for review! |
src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.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.
nice work! Just had a few nits to pick.
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.Accessibility.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.Accessibility.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.Accessibility.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.Ignored.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.Targets.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.Targets.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs
Outdated
Show resolved
Hide resolved
I would do that, but it is your call. However, I think we should at least change file names to not have a dot in them, i.e. replace the dot with |
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.Targets.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializersTests.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.
Consider testing what happens when the target of the [ModuleInitializerAttribute]
is the definition part of a static partial
method with no implementation part.
Consider testing what happens when the target of the [ModuleInitializerAttribute]
is the implementation part of a static partial
method.
edit: actually, these tests are probably moot for now since the partial methods must be 'private'
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.
Yes, though public partial methods in language design right now IIRC. Since I couldn't test that yet, I skipped it.
Done with review pass (iteration 31). |
0d7183f
to
64269a9
Compare
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 (iteration 35)
@AlekseyTs @RikkiGibson I switched to a folder instead of a partial class. Ready for squash merge :) |
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'm OK with this test organization.
@AlekseyTs I don't see an official sign off from you, please take another look and if you have no further feedback/concerns then we can merge. |
src/Compilers/CSharp/Test/Symbol/Symbols/ModuleInitializers/ModuleInitializersTests.cs
Show resolved
Hide resolved
Done with review pass (iteration 36) |
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 (iteration 37)
@jnm2 Thanks for the contribution. |
Thanks everyone for the help! |
Test plan: #40500
@RikkiGibson On combining diagnostic IDs: I didn't make any changes as of now. I have a preference for not combining the messages themselves ("either X or Y is wrong"). Because of the way localization works, I don't know if it's possible to vary the message wording for the same diagnostic ID.