-
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
Add IMethodGroupReferenceOperation
#76620
Comments
@333fred for thoughts. |
nameof
argument the same, regardless of the way it is expressed in the syntax tree, if the end semantics is the same.IMethodGroupReferenceOperation
@MarkKharitonov, good start. However, there's more information to capture here. This type of API needs to be the equivalent of something like |
I do not have much experience designing Roslyn APIs. Given my current state of knowledge, I have a feeling that the proposed API is already useful, albeit minimal. I do not think it contains anything redundant and it is possible to enrich it in the future with more features in a backwards compatible manner. Please, correct me if I am wrong. |
@MarkKharitonov The APIs are not designed based on the need of a particular consumer. The APIs here are more about practically exposing the real way the compiler views these language constructs across VB/C#. I'd recommend taking what Fred said into account here. For example, here are the APIs for BoundMethodGroup for boht VB and C#: https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/BoundTree/BoundMethodGroup.cs It would also make sense to see how we've exposed the concept of a group of members elsewhere to ensure consistency there. |
Well, for example, |
Background and Motivation
Please, see #76616.
Consider the following source code:
It demonstrates three different way to express the same
nameof
semantics. An important detail - the argument ofnameof
is a method group:Type1.f
- fully qualified through its parent type Type1Type3.f
- fully qualified through an alias Type3f
- unqualified, imported into the scope by theusing static Type1
directive.Inspecting the
INameOfOperation
yields different results for the third case as explained in great detail in the aforementioned issue.Proposed API
Seems like the only case that needs special attention is when the argument of the
nameof
operator is a method group. Hence the idea is to introduce something likeIMethodGroupReferenceOperation
:The text was updated successfully, but these errors were encountered: