-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
…InlineArray] types Closes dotnet#68867
@tannergooding FYI |
@@ -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> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 totrue
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?
Closes #68867
Relates to test plan #67826