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: Accept string literals in the fields of a record type #4664

Merged
merged 5 commits into from
Apr 22, 2022

Conversation

Marwes
Copy link
Contributor

@Marwes Marwes commented Apr 11, 2022

For #4388 we need a way to describe a type (label) variable in place of a record field.
As type variables are described as a single, uppercase letter, mimicking that syntax will make it
impossible to describe the literal field name "A", "B", etc. By allowing a string literal in this location one can always use this syntax to describe these single letter field names and also describe any other fields which do not fit into an identifier, for example "field with spaces", "symbols#%^".

Based on #4663

@Marwes Marwes force-pushed the property_key_in_record_type branch 2 times, most recently from 9796261 to e396f8b Compare April 12, 2022 12:53
@Marwes Marwes marked this pull request as ready for review April 12, 2022 13:37
@Marwes Marwes requested a review from a team as a code owner April 12, 2022 13:37
@Marwes Marwes requested review from jsternberg and removed request for a team April 12, 2022 13:37
@Marwes Marwes mentioned this pull request Apr 12, 2022
7 tasks
Copy link
Contributor

@nathanielc nathanielc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Can you update the docs/SPEC.md with the new grammar? I don't need to re-review once that is done.

Markus Westerlind added 2 commits April 22, 2022 13:36
For #4388 we need a way to describe a type (label) variable in place of a record field.
As type variables are described as a single, uppercase letter, mimicking that syntax will make it
impossible to describe the literal field name "A", "B", etc. By allowing a string literal in this location one can always use this syntax to describe these single letter field names and also describe any other fields which do not fit into an `identifier`, for example `"field with spaces"`, `"symbols#%^"`.
@Marwes Marwes force-pushed the property_key_in_record_type branch from e396f8b to 883d435 Compare April 22, 2022 11:36
@Marwes Marwes force-pushed the property_key_in_record_type branch from 883d435 to f42f690 Compare April 22, 2022 12:50
@Marwes Marwes merged commit e8afac2 into master Apr 22, 2022
@Marwes Marwes deleted the property_key_in_record_type branch April 22, 2022 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants