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

feat(compiler): Add support for Number[] and Number[>] syntax #2132

Closed

Conversation

spotandjake
Copy link
Member

This pr adds shorthand syntax for list and array 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> becomes Number[]
  • Array<Number> becomes Array[>]

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.

@spotandjake
Copy link
Member Author

Closing this because of the decision made on #387 to not have shorthands.

@spotandjake spotandjake closed this Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant