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 uncurry attribute on function application #2566

Merged

Conversation

anmonteiro
Copy link
Member

fixes #2565

cc @bobzhang

@bobzhang
Copy link
Contributor

A bit confused why this is not resolving in the parsing stage instead of post-processing

@anmonteiro
Copy link
Member Author

@bobzhang could you clarify your question? The change I made is in the parser

@bobzhang
Copy link
Contributor

My question is that when parser see f(. a,b), it parse it as uncurried function, why a post-processing is involved here?

@anmonteiro
Copy link
Member Author

I'm not sure, looks like legacy code that's moving attributes from the expression to the structure item.

@bobzhang
Copy link
Contributor

For this particular patch, you can use List.exists

@anmonteiro
Copy link
Member Author

I can certainly switch to that, though I wanted to make the diff as easy to review as possible.

The bug here is that we were checking the entire expression's attributes (could be a let .. in) instead of the application expression's attributes for an uncurry attribute.

@bobzhang
Copy link
Contributor

do you have an example of what mkstrexp is trying to achieve? I am a bit lost here
Maybe you can add a test case

@bobzhang
Copy link
Contributor

bobzhang commented May 5, 2020

ping?

@anmonteiro
Copy link
Member Author

happy to merge if you're happy with it. I don't have bandwidth to get rid of mkstrexp, or dig through history to find why it was added in the first place.

Otherwise I'm also happy to close this PR and let you fix the issue.

@bobzhang
Copy link
Contributor

bobzhang commented May 7, 2020

it seems to be introduced by this commit when introducing uncurried support: dabe031
@IwanKaramazow would you have a look why we need change mkstrexp here? thanks

@IwanKaramazow
Copy link
Contributor

Some context: [@attr] expr is Pstr_eval (expr, @attr). The purpose of mkstrexp is building a Pstr_eval that contains the attributes, not the expression inside the Pstr_eval.
I misunderstood this back in the days when implementing the original uncurried support.
[@bs] should not be lifted to the Pstr_eval level. I'm wondering if this branch https://github.com/facebook/reason/blob/535eb95cacef59eb6dc1ca8c34d053d16ba089df/src/reason-parser/reason_parser.mly#L432-L449 can be removed. Printer will need to be fixed.

@anmonteiro anmonteiro force-pushed the anmonteiro/fix-uncurry-attr-on-exp branch from 535eb95 to ce1a6eb Compare August 9, 2020 01:35
@anmonteiro anmonteiro merged commit ea0d3a3 into reasonml:master Aug 9, 2020
@anmonteiro anmonteiro deleted the anmonteiro/fix-uncurry-attr-on-exp branch August 9, 2020 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

f(.a,b) generates wrong attributes
4 participants