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

Bring back support for optional types in constructors #366

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

alex-pinkus
Copy link
Owner

In #353, adding _parenthesized_type caused new parse failures where the parser now resolved away from tuple_type too early. Specifically, when parsing an expression like [(any Foo) ..., the tuple_type interpretation must still be valid at that point in the expression in case we're about to see a ?.

The truly robust thing to do would be to support $.tuple_type as the target of the navigation expression. However, this leads to a large number of additional parse failures, as seen in #360. To avoid all of that, we add support in the opposite direction: allow tuple_type to be resolved using _parenthesized_type, so that the parser seeing the latter does not cause it to invalidate the former.

In #353, adding `_parenthesized_type` caused new parse failures where
the parser now resolved away from `tuple_type` too early. Specifically,
when parsing an expression like `[(any Foo) ...`, the `tuple_type`
interpretation must still be valid at that point in the expression in
case we're about to see a `?`.

The truly robust thing to do would be to support `$.tuple_type` as the
target of the navigation expression. However, this leads to a large
number of additional parse failures, as seen in #360. To avoid all of
that, we add support in the opposite direction: allow `tuple_type` to be
resolved using `_parenthesized_type`, so that the parser seeing the
latter does not cause it to invalidate the former.
@alex-pinkus alex-pinkus merged commit 9d27321 into main Mar 3, 2024
55 checks passed
@alex-pinkus alex-pinkus deleted the optional-types-in-constructors branch March 3, 2024 23:16
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.

1 participant