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

Update CA1820 to not report on expression trees #4621

Merged
merged 3 commits into from
Jan 5, 2021

Conversation

Evangelink
Copy link
Member

Fix #1508

@Evangelink Evangelink requested a review from a team as a code owner December 21, 2020 16:27
public static bool IsWithinLambdaOrLocalFunction(this IOperation operation, [NotNullWhen(true)] out IOperation? containingLambdaOrLocalFunctionOperation)
{
containingLambdaOrLocalFunctionOperation = operation.GetAncestor(s_LambdaAndLocalFunctionKinds);
return containingLambdaOrLocalFunctionOperation != null;
}

public static bool IsWithinExpressionTree(this IOperation operation,
[NotNullWhen(true)] INamedTypeSymbol? linqExpressionTreeType)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen two different approaches in the codebase and I am not sure which one is the preferred one:

  1. Take the named type
  2. Take the compilation and retrieve the named type from within the helper

@codecov
Copy link

codecov bot commented Dec 22, 2020

Codecov Report

Merging #4621 (4842463) into master (abb5bf7) will decrease coverage by 0.00%.
The diff coverage is 98.00%.

@@            Coverage Diff             @@
##           master    #4621      +/-   ##
==========================================
- Coverage   95.77%   95.77%   -0.01%     
==========================================
  Files        1193     1193              
  Lines      269067   269095      +28     
  Branches    16245    16248       +3     
==========================================
+ Hits       257706   257718      +12     
- Misses       9278     9283       +5     
- Partials     2083     2094      +11     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CA1820 incorrectly fires in LINQ expressions
2 participants