-
Notifications
You must be signed in to change notification settings - Fork 426
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 2695: local open + let bindings #2716
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks!
@@ -6442,7 +6442,12 @@ let printer = object(self:'self) | |||
(atom ("."))) | |||
(self#formatNonSequencyExpression e)) | |||
else | |||
Some (makeLetSequence (self#letList x)) | |||
Some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks exactly like the then
branch.
I'm surprised this doesn't break let open Foo; bar;
for example?
Perhaps the letop
case should be added to isSeriesOfOpensFollowedByNonSequencyExpression
, then we'd get printing for free?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, not exactly the same. The first branch results into extra braces:
- let* x = Js.Promise.resolve(42);
- Js.Promise.resolve(x * 2);
+ {
+ let* x = Js.Promise.resolve(42);
+ Js.Promise.resolve(x * 2);
+ }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did make a small change to avoid code duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how this is correct yet. I might be missing something.
Aren't we replacing ALL open
calls with Foo.( ... )
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly, but the solution wasn't perfect (it didn't work for nested local open modules). I've tried to improve on it with help of an extra attribute set by the parser.
Solves #2695.
Makes it possible to use:
Printing isn't perfect, but good enough for now.