-
Notifications
You must be signed in to change notification settings - Fork 467
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
Simplify AvoidUninstantiatedInternalClasses #6309
Conversation
// The type containing the assembly's entry point is OK. | ||
if (ContainsEntryPoint(type, compilation)) |
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.
On roslyn side, this is calculated once for the compilation and cached:
@mavasani Do you think this PR can contribute to #6301 ? (the new approach is very likely more efficient, but I'm not sure if the improvement is large enough here)
I'm not sure how much the existing code was expensive. Specifically, we could have been calling GetMembers
for lots of types. Did the compiler already cached them before invoking the analyzer? or does the analyzer come through this code path:
We also were doing more symbol comparison than with this PR
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.
Regardless of whether or not this addresses #6301, it seems to definitely be more hardened code and should likely also improve performance.
// TODO: Handle the case where Compilation.Options.MainTypeName matches this type. | ||
// TODO: Test: can't have type parameters. | ||
// TODO: Main in nested class? If allowed, what name does it have? | ||
// TODO: Test that parameter is array of int. |
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.
All these should be handled now by the compiler :)
@@ -375,7 +375,7 @@ public async Task CA1812_Basic_NoDiagnostic_MainMethodIsDifferentlyCasedAsync() | |||
OutputKind = OutputKind.ConsoleApplication, | |||
Sources = | |||
{ | |||
@"Friend Class C | |||
@"Friend Class [|C|] |
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.
This was false negative.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6309 +/- ##
=======================================
Coverage 96.08% 96.08%
=======================================
Files 1367 1367
Lines 315352 315307 -45
Branches 10187 10177 -10
=======================================
- Hits 302991 302963 -28
+ Misses 9930 9918 -12
+ Partials 2431 2426 -5 |
No description provided.