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

WIP: Prism work, merge only #403

Draft
wants to merge 498 commits into
base: master
Choose a base branch
from
Draft

WIP: Prism work, merge only #403

wants to merge 498 commits into from

Conversation

egiurleo
Copy link

This is a test for upstreaming our Prism work. In this PR, I've left all our commits as-is and just merged Prism master

Motivation

Test plan

See included automated tests.

egiurleo and others added 30 commits October 9, 2024 15:49
Getting all the test output was not particularly useful and created
a lot of noise.
Pass `--test_output=errors` flag to CI
Add a new script to verify that our prism regression parse trees
are up to date, and run that script in CI to make sure that we
are updating our parsing output as Sorbet master changes.
Move pattern-matching code into a new set of functions
Implement Prism -> Sorbet translation for alternation patterns (`a | b`)
Implement Prism -> Sorbet translation for variable binding in patterns
Implement Prism -> Sorbet translation for pinning patterns
Co-authored-by: Alexander Momchilov <[email protected]>
Implement Prism -> Sorbet translation for shareable constants
egiurleo and others added 30 commits December 19, 2024 10:54
Add `local_vars` tests to prism corpus and exclude failing test
Generate empty Args node for method definitions with empty parentheses
Fix failing local_vars test by translating post params!
Handle post `while`/`until` modifiers
And exclude failing tests
Add namer tests to Prism corpus
Modify locations of kw arguments and params to match legacy parser
In cases like `foo.()`, the message would be `:call`, but the message location
would have null start and end. In this case, we need to fall back to use
the call operator location.
Correctly translate no-message calls' message locations
This is not covered in parse tree location tests, but reflected in symbol
table tests: when we write `FOO = 1` (or other constant write nodes), the
location of `FOO` should just be the name, not the entire assignment.

In those cases, we should use `name_loc` instead of `base.location`.
Correctly translate constant write nodes' location
When the symbol is used as `a: 1`, the location should not include the colon.
Fix symbol location for hash, keyword argument keys
The main blocker for upstreaming Prism parser to Sorbet is that we currently
rely on Ruby to build Prism, as its required by Prism's `rake template` task.

But by package the files generated by `rake template` in Prim's release,
we will be able to remove the dependency on Ruby while significantly simplify
the build configurations for Prism.
…-release

Use improved libprism source to build Prism without dependency on Ruby
When ENFORCE macros fail, they use fmt (via spdlog) to format error messages.
Add a formatter specialization for pm_node_type to properly display Prism node
types in these error messages. Instead of showing numeric values, the formatter
uses pm_node_type_to_str to display human-readable node type names.
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.

3 participants