这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@dvulakh
Copy link

@dvulakh dvulakh commented May 23, 2024

Whenever it is possible to "pun" a let-binding, do so.

We do this for any let binding that is an extension or an operator and where the LHS and RHS are just the same identifier (no attached attributes, no type annotations).

I've added tests for a few tricky cases to let_punning.ml. I've also tested internally, and our styler runs without producing any syntax errors. More thorough testing will need to wait for the parser fix in compiler PR #2612.

@dvulakh dvulakh requested a review from ccasin May 23, 2024 19:51
Copy link

@ccasin ccasin left a comment

Choose a reason for hiding this comment

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

I read this and it looks fine to me (modulo questions below). But I'm going to hold off on approving until we've had a chance to test it on the tree because we could easily be missing some corner case.

Copy link

@ccasin ccasin left a comment

Choose a reason for hiding this comment

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

Approved, but will let David merge when he's ready.

dvulakh added 9 commits June 11, 2024 12:11
rewrite [let%foo bar = bar in ...] to [let%foo bar in] whenever
possible

includes tests for comments and some corner cases where it is better
not to pun

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
@dvulakh dvulakh force-pushed the dvulakh.enable-let-punning branch from d54c9a3 to 28556e4 Compare June 11, 2024 16:12
@dvulakh dvulakh merged commit 4a9e74e into jane Jun 21, 2024
@dvulakh dvulakh deleted the dvulakh.enable-let-punning branch June 21, 2024 19:12
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