Draft grammar to permit nullable types as array element types.#1297
Draft grammar to permit nullable types as array element types.#1297gafter wants to merge 4 commits intodotnet:draft-v8from
Conversation
| array_type | ||
| : non_array_type rank_specifier+ | ||
| | non_array_type rank_specifier+ | ||
| | non_array_type ( nullable_type_annotation rank_specifier+ )+ |
There was a problem hiding this comment.
No, because a nullable type isn't a non_array_type.
There was a problem hiding this comment.
If I'm reading it right, non_array_type includes value_type which includes nullable_value_type which I believe int? would be.
There was a problem hiding this comment.
I'd agree with @gafter. nullable_value_type is defined as non_nullable_value_type nullable_type_annotation. There's no additional condition for a nullable_value_type. So, int?? isn't a valid type.
There was a problem hiding this comment.
non_array_type may expand into value_type, which may expand into nullable_value_type, which expands into non_nullable_value_type nullable_type_annotation. Therefore, non_array_type may expand into non_nullable_value_type nullable_type_annotation. Substituting that:
non_array_type ( nullable_type_annotation rank_specifier+ )+
may be
non_nullable_value_type nullable_type_annotation ( nullable_type_annotation rank_specifier+ )+
Notice how nullable_type_annotation appears twice. The proposed grammar allows int??[] as a valid construction.
Nigel-Ecma
left a comment
There was a problem hiding this comment.
See TG2 email discussion for details.
jnm2
left a comment
There was a problem hiding this comment.
We want to wait for a meeting where @gafter is present to discuss this as well, but @jnm2 is keen to get his hands dirty with it when he finds time.
I made it happen! See #1386 for my proposed grammar changes. If we take my PR as the direction, @gafter's other changes in this PR will be valuable to move over.
BillWagner
left a comment
There was a problem hiding this comment.
Once grammar validation is added, I'm ready to accept this.
| array_type | ||
| : non_array_type rank_specifier+ | ||
| | non_array_type rank_specifier+ | ||
| | non_array_type ( nullable_type_annotation rank_specifier+ )+ |
There was a problem hiding this comment.
I'd agree with @gafter. nullable_value_type is defined as non_nullable_value_type nullable_type_annotation. There's no additional condition for a nullable_value_type. So, int?? isn't a valid type.
Proposed replacement for #1287
@Nigel-Ecma Can you please help me set up the testing for this PR?