Skip to content

C#: Read-only property flow. #15652

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

Merged
merged 4 commits into from
Feb 21, 2024

Conversation

michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Feb 19, 2024

Dataflow for "readonly" properties (properties with only a "getter") didn't work.
That is, Obj = o wasn't detected as a store step into the property Obj. This is fixed in this PR.

public class C
{
    public object Obj { get; }

    public C(object o)
    {
        Obj = o;
    }
}

@github-actions github-actions bot added the C# label Feb 19, 2024
@michaelnebel michaelnebel force-pushed the csharp/constructorflow branch from 5ae9e6b to d6f657c Compare February 20, 2024 14:56
@michaelnebel
Copy link
Contributor Author

DCA found some extra results (in test projects). I checked 2/3 using the information directly available in DCA and it looks like both these new results propagates information via property with only a getter, which looks correct.

@michaelnebel michaelnebel marked this pull request as ready for review February 21, 2024 07:44
@michaelnebel michaelnebel requested a review from a team as a code owner February 21, 2024 07:44
@michaelnebel michaelnebel added the no-change-note-required This PR does not need a change note label Feb 21, 2024
Copy link
Contributor

@tamasvajk tamasvajk left a comment

Choose a reason for hiding this comment

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

I think a change note should be added. This change might have a large impact on the number of issues found.

@michaelnebel michaelnebel removed the no-change-note-required This PR does not need a change note label Feb 21, 2024
Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

LGTM

@michaelnebel
Copy link
Contributor Author

Considering all the complicated stuff with primary constructors and getting that to work - this PR might have much larger impact 😭 .

@michaelnebel michaelnebel merged commit f072e41 into github:main Feb 21, 2024
@michaelnebel michaelnebel deleted the csharp/constructorflow branch February 21, 2024 09:12
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.

3 participants