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

Get field name from attribute when pattern matching #6456

Merged
merged 4 commits into from
Oct 30, 2023

Conversation

shulhi
Copy link
Member

@shulhi shulhi commented Oct 29, 2023

Fix for #6438

PS: First time contributor here. It would be nice to get some guidance on a proper way to contribute this fix properly. (I have read the contributing guidelines).

@@ -26,6 +26,19 @@ open Printf

let dbg = false

let find_name (attr : Parsetree.attribute) =
Copy link
Member Author

Choose a reason for hiding this comment

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

This is similar to find_name in jscomp/core/record_attributes_check.ml. I prefer if this can be extracted to a common place where both places can use the same function, not sure where though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks identical. Can't you use the one from record_attributes_check.ml?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks identical. Can't you use the one from record_attributes_check.ml?

I tried, but record_attributes_check.ml is in the core package, and trying to import it from ml causes a circular import.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried, but record_attributes_check.ml is in the core package, and trying to import it from ml causes a circular import.

Sorry I'm an idiot, I can reverse the dependency 🤦

@zth
Copy link
Collaborator

zth commented Oct 30, 2023

Looks good to me! Maybe it's tested elsewhere but it'd be good to add a prop that's not renamed as well in the same test, just to be sure it's not changed.

@cristianoc any comments?

@cristianoc cristianoc marked this pull request as ready for review October 30, 2023 07:50
@cristianoc
Copy link
Collaborator

Looks great!
One line of changelog and I think it's ready to merge.

@zth
Copy link
Collaborator

zth commented Oct 30, 2023

@shulhi congratulations on a great first contribution!

@shulhi
Copy link
Member Author

shulhi commented Oct 30, 2023

Looks great! One line of changelog and I think it's ready to merge.

Changelog updated.

@zth zth merged commit ab0e9e8 into rescript-lang:master Oct 30, 2023
14 checks passed
@shulhi shulhi deleted the fix-6438-as-inline-record branch October 30, 2023 09:55
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