-
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
Exclude entry points from unused members analysis #45090
Conversation
@@ -689,7 +696,7 @@ private bool IsCandidateSymbol(ISymbol memberSymbol) | |||
} | |||
|
|||
private bool IsEntryPoint(IMethodSymbol methodSymbol) | |||
=> methodSymbol.Name == WellKnownMemberNames.EntryPointMethodName && | |||
=> (methodSymbol.Name == WellKnownMemberNames.EntryPointMethodName || methodSymbol.Name == "$Main") && |
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.
@AlekseyTs Ideally we would use a helper for "unspeakable names", but I couldn't find one. Can you point us in the right direction?
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.
Ideally we would use a helper for "unspeakable names", but I couldn't find one. Can you point us in the right direction?
SyntaxFacts.IsValidIdentifier
?
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.
You also mentioned ISymbol.CanBeReferencedByName
offline. However, it doesn't feel right to include all methods with unspeakable names into entry points.
In reply to: 439097752 [](ancestors = 439097752)
@@ -689,7 +696,7 @@ private bool IsCandidateSymbol(ISymbol memberSymbol) | |||
} | |||
|
|||
private bool IsEntryPoint(IMethodSymbol methodSymbol) | |||
=> methodSymbol.Name == WellKnownMemberNames.EntryPointMethodName && | |||
=> (methodSymbol.Name == WellKnownMemberNames.EntryPointMethodName || methodSymbol.Name == "$Main") && |
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.
"$Main" [](start = 107, length = 7)
Perhaps we should move constant from SynthesizedSimpleProgramEntryPointSymbol to WellKnownMemberNames and use it 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.
Perhaps we should move constant from SynthesizedSimpleProgramEntryPointSymbol to WellKnownMemberNames and use it here?
I'll file a follow-up issue for this.
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 1)
CC @mavasani |
Fixes #45496