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

Restore feature to tell people when a lambda is unnecessary. #58875

Merged
merged 38 commits into from
Jan 18, 2022

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Jan 15, 2022

Fixes #40364

Looks like this:

image

Note the faded sections in the lambda. Invoking the fix gives you:

image

We used to have this feature, but had to disable it because this 'fix' could make performance worse due to the compiler no longer caching this delegate in the case of some static call. However, now that #58288 has gone in, the compiler will still cache these method group conversions if you are on C#11 or above.

This allows us to reenable the feature.

--

Note: this feature can be entirely disabled by suppressing this diagnostic ID. in that case no messages or fading will occur :)

todo:

  • Gui option to turn this off.

Relates to test plan #52192

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner January 15, 2022 04:55
@CyrusNajmabadi CyrusNajmabadi merged commit 33ff264 into dotnet:main Jan 18, 2022
@ghost ghost added this to the Next milestone Jan 18, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the simplifyLambda branch January 18, 2022 06:30
@RikkiGibson RikkiGibson modified the milestones: Next, 17.2.P1 Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion to simplify lambda and delegate syntax
7 participants