-
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
List patterns: use the same binding path as range indexers #53784
Conversation
This comment has been minimized.
This comment has been minimized.
LookupResult lookupResult, | ||
BoundExpression? receiverOpt, | ||
TypeSymbol receiverType, | ||
bool argIsIndex, | ||
[NotNullWhen(true)] out Symbol? patternSymbol, | ||
BindingDiagnosticBag diagnostics, | ||
ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, | ||
bool forPattern = false) | ||
ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) |
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.
Not for this PR: I was looking at this code some more (to merge conflicts from main
branch) and wondered why we have both diagnostics and use-site info in this signature and some relates ones.
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.
@jcouv Should we create a DiagnosticBag off of useSiteInfo where we need one? I don't know if that's possible though.
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.
@alrz I can't look at the full code at the moment, so this is a general thought:
If this method selects a property to use, then a diagnostic bag should be enough (no need to delay the "use").
If the method only returns a candidate, then it should only produce use-site information but not use a diagnostic bag. The caller which decides to use the candidate is responsible for recording the use (ie transferring use-site information into diagnostic bag).
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.
Yeah I think we should use useSiteInfo for everything here e.g. obsolete errors and others.
I was looking for AddDiagnostics(UseSiteInfo<TAssemblySymbol> info)
I think that's the one we should use.
…t-patterns-03 # Conflicts: # src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
Merged to #54335 |
Test plan: #51289