Skip to content

RS1024: fix false positive on object creation#4571

Merged
mavasani merged 1 commit intodotnet:masterfrom
Evangelink:RS1024-obj-creation
Dec 17, 2020
Merged

RS1024: fix false positive on object creation#4571
mavasani merged 1 commit intodotnet:masterfrom
Evangelink:RS1024-obj-creation

Conversation

@Evangelink
Copy link
Copy Markdown
Member

Fix #4568

@Evangelink Evangelink requested a review from a team as a code owner December 14, 2020 18:54
!createdType.TypeArguments.IsEmpty &&
IsSymbolType(createdType.TypeArguments[0], symbolType) &&
!objectCreation.Arguments.Any(arg => IsSymbolType(arg.Type, symbolEqualityComparerType)))
!objectCreation.Arguments.Any(arg => IsSymbolType(arg.Value, symbolEqualityComparerType)))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@ryzngard can you please review?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's the second similar fix I am doing which makes me question a change on Roslyn.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looking at this one right after #4477

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's the second similar fix I am doing which makes me question a change on Roslyn.

Just to make sure I'm interpreting correctly. You hit these issues while working in Roslyn and are fixing here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry no, I meant that this is the second issue raised on roslyn-analyzers related to getting the type on a conversion. I am wondering if the code used to work and it stopped when we have moved to a newer version of Roslyn. My point is to say, maybe there is a regression on Roslyn side regarding these operations (Type wasn't null and now is).

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 14, 2020

Codecov Report

Merging #4571 (bf1d2c6) into master (ee5f74e) will decrease coverage by 0.03%.
The diff coverage is 89.88%.

@@            Coverage Diff             @@
##           master    #4571      +/-   ##
==========================================
- Coverage   95.84%   95.81%   -0.04%     
==========================================
  Files        1177     1177              
  Lines      268257   268257              
  Branches    16202    16202              
==========================================
- Hits       257100   257019      -81     
- Misses       9090     9092       +2     
- Partials     2067     2146      +79     

Copy link
Copy Markdown

@ryzngard ryzngard left a comment

Choose a reason for hiding this comment

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

It's unfortunate how easy this mistake was to miss :/. Thanks for fixing!

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.

Constructing a HashSet<ISymbol> with SymbolEqualityComparer should not generate any warnings

3 participants