Skip to content

CA1805: Fix FP with parameterless ctor on value types#5813

Merged
Evangelink merged 12 commits intodotnet:mainfrom
Evangelink:CA1805-valuetype-new
Jul 11, 2022
Merged

CA1805: Fix FP with parameterless ctor on value types#5813
Evangelink merged 12 commits intodotnet:mainfrom
Evangelink:CA1805-valuetype-new

Conversation

@Evangelink
Copy link
Copy Markdown
Member

@Evangelink Evangelink commented Jan 24, 2022

Fixes #5750 and fixes #5887

@Evangelink Evangelink requested a review from a team as a code owner January 24, 2022 20:26
@mavasani
Copy link
Copy Markdown

@stephentoub for review

Copy link
Copy Markdown
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Thanks.

Comment thread eng/Versions.props Outdated
Copy link
Copy Markdown

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

Waiting for question to be answered

@Evangelink Evangelink requested a review from sharwell February 11, 2022 15:42
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 11, 2022

Codecov Report

Merging #5813 (7a4878f) into main (58db3ef) will increase coverage by 0.01%.
The diff coverage is 98.90%.

❗ Current head 7a4878f differs from pull request most recent head 5605d64. Consider uploading reports for the commit 5605d64 to get more accurate results

@@            Coverage Diff             @@
##             main    #5813      +/-   ##
==========================================
+ Coverage   96.03%   96.04%   +0.01%     
==========================================
  Files        1338     1325      -13     
  Lines      307627   306254    -1373     
  Branches     9803     9693     -110     
==========================================
- Hits       295427   294142    -1285     
+ Misses       9817     9775      -42     
+ Partials     2383     2337      -46     

Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

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

Can you add few tests for #5887?

public record struct MyRecord()
{
    public bool SomeBool { get; set; } = false;
}

public record struct MyRecord
{
    public MyRecord() { }
    public bool SomeBool { get; set; } = false;
}

Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

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

There is no test for a struct without explicit constructor. This now produces CS8983 error anyway, so we may not care, but it didn't use to produce an error before dotnet/roslyn@3e4cc4c (even before that commit I'm not sure why issue states it being a false positive)

@Evangelink
Copy link
Copy Markdown
Member Author

@stephentoub @Youssef1313 ready for review. Thanks!

Copy link
Copy Markdown
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Thanks.

@mavasani mavasani enabled auto-merge March 22, 2022 15:18
@Evangelink Evangelink disabled auto-merge March 24, 2022 07:53
@Evangelink
Copy link
Copy Markdown
Member Author

@stephentoub @Youssef1313 PR should be finally ready.

@ManickaP
Copy link
Copy Markdown
Member

ManickaP commented Jul 9, 2022

I'm hitting this problem in my PR, so it would be great if we could merge this. @Evangelink is the PR ready to be merged? Has it become stale?

@Evangelink
Copy link
Copy Markdown
Member Author

@ManickaP I will merge main to have the CI issues fixed but as far as I remember it was ready to be merged.

@Evangelink Evangelink enabled auto-merge July 11, 2022 15:35
@Evangelink Evangelink merged commit 034886d into dotnet:main Jul 11, 2022
@github-actions github-actions bot added this to the vNext milestone Jul 11, 2022
@Evangelink Evangelink deleted the CA1805-valuetype-new branch July 11, 2022 17:54
@jmarolf jmarolf modified the milestones: vNext, .NET 7.x Nov 15, 2022
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.

Required initializer is marked as not required by CA1805 False positive CA1805 when using parameterless value type ctor (C# 10)

7 participants