Skip to content

Small fixes to generated IR node and visitor types #1327

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

Merged
merged 4 commits into from
Jun 9, 2025

Conversation

ggiraldez
Copy link
Contributor

  • Call enter/leave visitor methods when accepting choice types. These methods were added to the visitor trait, but were never called from the accept functions.
  • When generating IR node types for precedence expressions with multiple operator variants, those are collapsed into a single struct and we lose track of the operator that acts as a discriminant, because it's normally a unique terminal. Detect this case and don't remove the terminals in these cases. Eg. for an AdditiveExpression we now have the operator, a PLUS or a MINUS.

@ggiraldez ggiraldez requested review from a team as code owners May 14, 2025 23:09
Copy link
Contributor

@OmarTawfik OmarTawfik left a comment

Choose a reason for hiding this comment

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

Left a couple of questions. Thanks.

Copy link

changeset-bot bot commented May 26, 2025

⚠️ No Changeset found

Latest commit: 47c88a9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ggiraldez ggiraldez requested a review from OmarTawfik May 26, 2025 15:19
OmarTawfik
OmarTawfik approved these changes Jun 8, 2025
@ggiraldez ggiraldez added this pull request to the merge queue Jun 9, 2025
Merged via the queue into NomicFoundation:main with commit 219b0b8 Jun 9, 2025
2 checks passed
@ggiraldez ggiraldez deleted the ir-type-fixes branch June 9, 2025 16:07
mjoerussell pushed a commit to manastech/slang that referenced this pull request Jun 13, 2025
)

- Call enter/leave visitor methods when accepting choice types. These
methods were added to the visitor trait, but were never called from the
accept functions.
- When generating IR node types for precedence expressions with multiple
operator variants, those are collapsed into a single struct and we lose
track of the operator that acts as a discriminant, because it's normally
a unique terminal. Detect this case and don't remove the terminals in
these cases. Eg. for an `AdditiveExpression` we now have the operator, a
`PLUS` or a `MINUS`.
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