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

C#: Promote existing ad-hoc consistency checks to consistency queries #7469

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Dec 22, 2021

Identified two issues that are fixed on this PR.

@hvitved hvitved force-pushed the csharp/promote-adhoc-consistency-checks branch from 3eb612b to 8a62778 Dec 22, 2021
@hvitved hvitved marked this pull request as ready for review Dec 22, 2021
@hvitved hvitved requested review from as code owners Dec 22, 2021
var child = 0;
foreach (var arg in initializer.ArgumentList.Arguments)
{
Expression.Create(Context, arg.Expression, init, child++);
}
Copy link
Contributor

@tamasvajk tamasvajk Dec 22, 2021

Choose a reason for hiding this comment

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

I think the same changes should be applied to the similar cases in:

Maybe it's not possible in all cases to use each of ref, out or in. But in works in the below, and I don't think we extract it:

using System;
public class C {
    public void M() {
        var i = 1;
        new C { [in i] = 42 };
    }
    
    public int this[in int i] {
        get { return 42; }
        set { Console.WriteLine(value); }
    }
}

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

Successfully merging this pull request may close these issues.

None yet

2 participants