Skip to content
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

Completion for this is always offered in anonymous functions #27923

Closed
Neme12 opened this issue Jun 15, 2018 · 9 comments · Fixed by #28776
Closed

Completion for this is always offered in anonymous functions #27923

Neme12 opened this issue Jun 15, 2018 · 9 comments · Fixed by #28776
Labels
3 - Working Area-IDE Bug good first issue The issue is reserved for a first time, non-Microsoft contributor
Milestone

Comments

@Neme12
Copy link
Contributor

Neme12 commented Jun 15, 2018

using System;

class Foo
{
    static void M()
    {
        Action a = () =>
        {
			$$
        };

        Action b = delegate
        {
            $$
        };
    }
}

In both places at $$, this keyword is offered even though the method is static.

Discovered here:
#27690 (review)

I believe the fix should be really easy - just modify method.MethodKind == MethodKind.LocalFunction to method.MethodKind == MethodKind.LocalFunction || method.MethodKind == MethodKind.AnonymousFunction and add appropriate tests including nested anonymous functions and possibly even cases with a lambda inside a local function and vice versa, if you want to be extra diligent 😄

@Neme12
Copy link
Contributor Author

Neme12 commented Jun 15, 2018

Would marking this as "help wanted" or "good first issue" be appropriate?

@jcouv jcouv added help wanted The issue is "up for grabs" - add a comment if you are interested in working on it Area-IDE labels Jun 15, 2018
@jcouv
Copy link
Member

jcouv commented Jun 15, 2018

Done. Thanks for catching and filing this

@jcouv jcouv added the good first issue The issue is reserved for a first time, non-Microsoft contributor label Jun 15, 2018
@nprad
Copy link
Contributor

nprad commented Jun 16, 2018

I would like to take up this issue as my first contribution to this project if possible.

@jcouv
Copy link
Member

jcouv commented Jun 16, 2018

Nice. Go for it.
The linked issue should be a guide (it fixed local functions, but missed anonymous functions).

@jcouv jcouv added 3 - Working and removed help wanted The issue is "up for grabs" - add a comment if you are interested in working on it labels Jun 16, 2018
@sharwell sharwell added the Bug label Jun 16, 2018
@jinujoseph jinujoseph added this to the Unknown milestone Jun 19, 2018
@Neme12
Copy link
Contributor Author

Neme12 commented Jul 18, 2018

@nprad Are you still interested in fixing this? Do you need any help?

@nprad
Copy link
Contributor

nprad commented Jul 19, 2018

I apologize for the delay on this. Yes, I'm still interested in contributing to this ticket. I'll try to have a PR by the end of the weekend if that okay with you.

@Neme12
Copy link
Contributor Author

Neme12 commented Jul 22, 2018

No need to apologize. This is a very minor and low-priority issue, so you don't have to hurry. Yes it is okay with me (though I'm just a contributor, so whether or not it is ok with me is not really relevant, but I'm pretty sure the team is ok with that too 😄)

@Neme12
Copy link
Contributor Author

Neme12 commented Jul 22, 2018

This "issue" could be sitting here for years and noone would care, so you can take your time I think 😃 I reported it because I found this during code review, not because it is important to me.

@BlakeWills
Copy link

I submitted a PR for this issue last night, not realising there is already one outstanding. The other PR doesn't currently pass the build, so I'll leave mine open. I'm happy to close it off if needed though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Working Area-IDE Bug good first issue The issue is reserved for a first time, non-Microsoft contributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants