fix: Match TyN pattern against TyExpr (N ...) source #5540
Merged
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.
See the changed test for the goal. In JS, constructors can be arbitrary
expressions, so they are parsed into
TyExpr
. However, that leads tomissed matches.
The obvious solution is to desugar
TyExpr (N ...)
toTyN
whileconstructing the AST. I first tried to do this by modifiying
AST_generic_helpers.expr_to_type
to do this desugaring, but I ran intothe regression test added in
#4682.
It would be nice if there were a point where we could do this
desugaring, rather than having to handle it specifically in matching.
I'm not sure where it would make sense to do so, though.
Test plan: Automated tests
PR checklist: