Remove underscore if placeholder is in first position#8033
Merged
shulhi merged 8 commits intorescript-lang:masterfrom Dec 26, 2025
Merged
Remove underscore if placeholder is in first position#8033shulhi merged 8 commits intorescript-lang:masterfrom
shulhi merged 8 commits intorescript-lang:masterfrom
Conversation
c759df6 to
d13942e
Compare
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
d13942e to
65ac40c
Compare
nojaf
approved these changes
Dec 26, 2025
Member
nojaf
left a comment
There was a problem hiding this comment.
Looks good, don't forget your changelog entry.
Member
|
@shulhi Thanks! Cann you add a CHANGELOG entry and maybe add a comment to address @nojaf's concern? As for release management, I think this one is fine to go into 12.0.2 (current master) as a fix for weird formatting after migration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #8013
This PR improves the formatter's handling of underscore placeholders (_) in pipe expressions by automatically converting them to their canonical form. When a placeholder appears in the first position of a piped function call and it's the only placeholder occurrence, the formatter now omits it since the pipe operator already provides that argument.
Examples:
a->map2(_, fn)→ formats toa->map2(fn)filterNone->Array.get(_, 0)→ formats tofilterNone->Array.get(0)The formatter preserves multiple placeholders when they're semantically meaningful (e.g.,
a->f(_, _, b)remains unchanged).