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

Specially handle more scenarios for type parameters with 'allows ref struct' constraint #73363

Conversation

AlekseyTs
Copy link
Contributor

No description provided.

@AlekseyTs AlekseyTs requested review from jjonescz and cston May 7, 2024 14:25
@AlekseyTs AlekseyTs requested a review from a team as a code owner May 7, 2024 14:25
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label May 7, 2024
@AlekseyTs
Copy link
Contributor Author

@cston, @jjonescz, @dotnet/roslyn-compiler Please review

@AlekseyTs
Copy link
Contributor Author

@cston, @jjonescz, @dotnet/roslyn-compiler Please review

public ref struct S1 : I1<S1>
{
public int P {get;set;}
public static S1 Create() => default;
Copy link
Member

@cston cston May 8, 2024

Choose a reason for hiding this comment

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

default

Consider throwing instead in S1.Create() and S2.Create(). #Resolved

// s2 = (s1 ??= s2);
Diagnostic(ErrorCode.ERR_EscapeVariable, "s1 ??= s2").WithArguments("s1").WithLocation(11, 15)
);
}
Copy link
Member

@cston cston May 8, 2024

Choose a reason for hiding this comment

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

}

Consider testing:

static T F<T>() where T : allows ref struct
{
    scoped T s1 = default;
    T s2 = default;
    s2 ??= s1;
    return s2;
}
``` #Resolved

public ref struct S1 : I1<S1>
{
public int P {get;set;}
public static S1 Create() => default;
Copy link
Member

@cston cston May 8, 2024

Choose a reason for hiding this comment

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

default

Consider throwing for S1.Create() and S2.Create(). #Resolved

comp,
expectedOutput: ExecutionConditionUtil.IsMonoOrCoreClr ? "123 246" : null,
verify: ExecutionConditionUtil.IsMonoOrCoreClr ? Verification.Passes : Verification.Skipped).VerifyDiagnostics();
}
Copy link
Member

@cston cston May 8, 2024

Choose a reason for hiding this comment

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

}

Are we testing the corresponding cases for collection expressions? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are we testing the corresponding cases for collection expressions?

CollectionExpressions_01?

@AlekseyTs
Copy link
Contributor Author

@jjonescz, @dotnet/roslyn-compiler For the second review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - RefStructInterfaces untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants