Skip to content

Formatter: add & to yielding methods without a block parameter#12951

Merged
straight-shoota merged 3 commits intocrystal-lang:masterfrom
HertzDevil:feature/formatter-add-anonymous-block-param
Jan 16, 2023
Merged

Formatter: add & to yielding methods without a block parameter#12951
straight-shoota merged 3 commits intocrystal-lang:masterfrom
HertzDevil:feature/formatter-add-anonymous-block-param

Conversation

@HertzDevil
Copy link
Contributor

@HertzDevil HertzDevil commented Jan 13, 2023

Resolves part of #8764.

This is not done to macros because they don't overload by block presence; all macros may be called with or without a block, regardless of whether the macro yields, whether the block parameter exists, and whether that parameter has a name.

0a4474a adds a total of 553 anonymous block parameters to the repository this way.

@straight-shoota straight-shoota added this to the 1.8.0 milestone Jan 15, 2023
@straight-shoota straight-shoota merged commit f0bd16a into crystal-lang:master Jan 16, 2023
@HertzDevil HertzDevil deleted the feature/formatter-add-anonymous-block-param branch January 18, 2023 13:21
SamantazFox added a commit to SamantazFox/invidious that referenced this pull request Jan 21, 2023
straight-shoota added a commit to straight-shoota/crystal-book that referenced this pull request Jan 25, 2023
Adds block argument to signature of yielding methods (crystal-lang/crystal#12951).
@veelenga
Copy link
Contributor

veelenga commented Feb 19, 2023

This change introduces a small issue formatting a method with inlined comments

def foo # my foo method
  yield 42
end

formats to

def foo # my foo method(&)
  yield 42
end

@straight-shoota
Copy link
Member

Thanks for reporting. I created a new issue #13091 to track this.

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.

3 participants

Comments