Trailing comma in collection expressions #71208
-
It looks like the compiler supports trailing commas in collection expressions because the following code compiles successfully (SharpLab): int[] list = [1, 2, 3, ];
// ----------------- ^ trailing comma In the proposal Collection expressions, the syntax is described as: + collection_expression
: '[' ']'
| '[' collection_element ( ',' collection_element )* ']'
;
+ collection_element
: expression_element
| spread_element
;
+ expression_element
: expression
;
+ spread_element
: '..' expression
; I understand it as "After the comma, the Does this mean my understanding is incorrect or a different specification was used during development? |
Beta Was this translation helpful? Give feedback.
Answered by
CyrusNajmabadi
Dec 11, 2023
Replies: 1 comment
-
A different specification was used during development. We'll fix up the lang spec. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ViIvanov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A different specification was used during development. We'll fix up the lang spec. Thanks!