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

fix: Match TyN pattern against TyExpr (N ...) source #5540

Merged
merged 2 commits into from
Jun 15, 2022
Merged

Conversation

nmote
Copy link
Collaborator

@nmote nmote commented Jun 15, 2022

See the changed test for the goal. In JS, constructors can be arbitrary
expressions, so they are parsed into TyExpr. However, that leads to
missed matches.

The obvious solution is to desugar TyExpr (N ...) to TyN while
constructing the AST. I first tried to do this by modifiying
AST_generic_helpers.expr_to_type to do this desugaring, but I ran into
the 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:

  • Documentation is up-to-date
  • Changelog is up-to-date
  • Change has no security implications (otherwise, ping security team)

@nmote nmote requested review from aryx, emjin and mmcqd June 15, 2022 16:16
@nmote
Copy link
Collaborator Author

nmote commented Jun 15, 2022

Oh, also I need to update the changelog

See the changed test for the goal. In JS, constructors can be arbitrary
expressions, so they are parsed into `TyExpr`. However, that leads to
missed matches.

The obvious solution is to desugar `TyExpr (N ...)` to `TyN` while
constructing the AST. I first tried to do this by modifiying
`AST_generic_helpers.expr_to_type` to do this desugaring, but I ran into
the 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
@github-actions
Copy link
Contributor

📸 The pytest shapshots changed in your PR.
Please carefully review these changes and make sure they are intended:

  1. Review the changes at 98f8657

  2. Accept the new snapshots with

    git fetch origin && git cherry-pick 98f86574 && git push
    

@underyx
Copy link
Member

underyx commented Jun 15, 2022

@nmote security team is fixing the registry state which caused your test failure. Please don't apply the snapshot changes & feel free to merge with pytest failing.

@nmote
Copy link
Collaborator Author

nmote commented Jun 15, 2022

@underyx thanks, I was just looking into that. Wasn't going to apply without figuring out what was going on.

@nmote nmote merged commit bf5ce3c into develop Jun 15, 2022
@nmote nmote deleted the nmote/js branch June 15, 2022 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants