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

Surface a warning at the declaration site for language incompatible [InlineArray] types #69144

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

AlekseyTs
Copy link
Contributor

@AlekseyTs AlekseyTs commented Jul 21, 2023

Closes #68867

Relates to test plan #67826

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

@tannergooding FYI

@AlekseyTs
Copy link
Contributor Author

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

@@ -7700,4 +7700,10 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="WRN_InlineArrayConversionOperatorNotUsed_Title" xml:space="preserve">
<value>Inline array conversion operator will not be used for conversion from expression of the declaring type.</value>
</data>
<data name="WRN_InlineArrayNotSupportedByLanguage" xml:space="preserve">
<value>'Inline arrays' language feature is not supported for inline array types with element field which is either a 'ref' field, or has type that is not valid as a type argument.</value>
Copy link
Member

@jjonescz jjonescz Jul 24, 2023

Choose a reason for hiding this comment

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

Why a separate error for ref fields? Couldn't ERR_InlineArrayUnsupportedElementFieldModifier be used for that? #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.

Why a separate error for ref fields? Couldn't ERR_InlineArrayUnsupportedElementFieldModifier be used for that?

It cannot. The ERR_InlineArrayUnsupportedElementFieldModifier is an error. This is a warning. And it is reported for scenarios other than ref fields as well.

@AlekseyTs
Copy link
Contributor Author

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

@@ -1754,9 +1754,12 @@ protected override void AfterMembersCompletedChecks(BindingDiagnosticBag diagnos

if (TryGetPossiblyUnsupportedByLanguageInlineArrayElementField() is FieldSymbol elementField)
{
bool reported_ERR_InlineArrayUnsupportedElementFieldModifier = false;
Copy link
Member

Choose a reason for hiding this comment

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

reported_ERR_InlineArrayUnsupportedElementFieldModifier

Consider naming this reportInlineArrayNotSupported, and set to true in the case of pointers or restricted types below, so the error can be reported in one location rather than two.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider naming this reportInlineArrayNotSupported, and set to true in the case of pointers or restricted types below, so the error can be reported in one location rather than two.

I am not sure what you have in mind exactly. Could you elaborate, please?

@AlekseyTs AlekseyTs merged commit c3467f3 into dotnet:main Jul 24, 2023
25 checks passed
@ghost ghost added this to the Next milestone Jul 24, 2023
@allisonchou allisonchou modified the milestones: Next, 17.8 P1 Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers New Feature - Inline Arrays 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.

Surface a warning at the declaration site for language incompatible [InlineArray] types
4 participants