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

IndexTargetNode should always have ATTRIBUTE_WRITE #2118

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

kddnewton
Copy link
Collaborator

Fixes #2102

Because this is a user-facing change, we also need to deal with the fact that CRuby 3.3.0 was just released.

In order to support workflows that want to parse exactly as CRuby parses in a specific version, this PR introduces a new option to the options struct that is "version". This allows you to specify that you want "3.3.0" parsing.

I'm not sure if this is the correct solution. Another solution is to just fork and keep around the old branch for security patches. Or we could keep around a copy of the source files within this repository as another directory and only update when necessary. There are a lot of potential solutions here.

Because this change is so small and the check for it is so minimal, I've decided to go with this enum. If this ends up entirely cluttering the codebase with version checks, we'll come up with another solution. But for now this works, so we're going to go in this direction for a bit until we determine it's no longer working.

@enebo
Copy link
Collaborator

enebo commented Jan 2, 2024

@kddnewton I only wonder if you should not use LATEST and just speculatively assume 3.4? It is possible MRI will pick another version number and 3.4 is not out for a year but it seems weird from a process perspective to mark LATEST on 3.4 syntax features. When 3.4 does come out you will have to global replace those to 3.4 and then use LATEST for 3.5.

Because this is a user-facing change, we also need to deal with the
fact that CRuby 3.3.0 was just released.

In order to support workflows that want to parse exactly as CRuby
parses in a specific version, this PR introduces a new option to
the options struct that is "version". This allows you to specify
that you want "3.3.0" parsing.

I'm not sure if this is the correct solution. Another solution is
to just fork and keep around the old branch for security patches.
Or we could keep around a copy of the source files within this
repository as another directory and only update when necessary.
There are a lot of potential solutions here.

Because this change is so small and the check for it is so minimal,
I've decided to go with this enum. If this ends up entirely
cluttering the codebase with version checks, we'll come up with
another solution. But for now this works, so we're going to go in
this direction for a bit until we determine it's no longer working.
@kddnewton kddnewton force-pushed the index-target-node-attr-write branch from 8c3ee60 to d8c7e6b Compare January 2, 2024 16:37
@kddnewton
Copy link
Collaborator Author

@enebo yeah great point. I just updated it

@kddnewton kddnewton merged commit 0f1ea0c into main Jan 2, 2024
46 checks passed
@kddnewton kddnewton deleted the index-target-node-attr-write branch January 2, 2024 18:51
Comment on lines +2177 to +2179
if (parser->version != PM_OPTIONS_VERSION_CRUBY_3_3_0) {
flags |= PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE;
}
Copy link
Member

@eregon eregon Jan 9, 2024

Choose a reason for hiding this comment

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

@andrykonchin and I are looking at which version we'd set.
We do want the flag to be set here.
But with the current code that means we'd need to use PM_OPTIONS_VERSION_LATEST.

OTOH we do not want it handling from 3.4 (#2124).
And using PM_OPTIONS_VERSION_LATEST would enable it.

So how to solve this?
Maybe we need PM_OPTIONS_VERSION_CRUBY_3_3 (without _0) to mean 3.3 syntax with the latest fixes?
Alternatively, is it worth hiding this flag for Prism versions newer than the one shipped with 3.3.0? Maybe not?
It feels like this flag should not hurt anything, and if someone wants exactly the version of Prism as shipped in 3.3.0 then they can just specify that Prism release in their Gemfile.
In short adding PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE is not really a syntax change or different parsing or anything, it's just extra information or from a POV a bug fix for a missing flag.

Copy link
Member

@eregon eregon Jan 9, 2024

Choose a reason for hiding this comment

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

@kddnewton WDYT?
Feel free to extract this to an issue/discussion if you prefer to discuss it somewhere else.
EDIT: I moved it to #2163

Copy link
Member

Choose a reason for hiding this comment

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

Maybe the fundamental question is whether this change would go in CRuby 3.3.1. I think it should as a bug fix.

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.

IndexTargetNode doesn't have ATTRIBUTE_WRITE
3 participants