feat(compiler): Add support for Number[]
and Number[>]
syntax
#2132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pr adds shorthand syntax for
list
andarray
types which is discussed in #387, I think if we want the?
and!
shorthands we should have some more discussion, but the list and array syntax seem generalized enough that it is worth having. As far as I am aware this pr is non breaking because the old syntax still works. The syntax can be seen below:List<Number>
becomesNumber[]
Array<Number>
becomesArray[>]
This pr is not ready to be merged as I still need to add tests, make sure the formatter handles this correctly and make sure types get stringified using the shorthand in the lsp and graindoc. I am putting this pr before doing that as I want to make sure that we are okay with doing handling this in the parser instead of adding a parseTree element, given this is syntax sugar it seemed like the best option.
Currently this pr is not breaking as far as I am aware given we do not remove the
List<Number>
syntax and this would have been completely invalid syntax before.