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 ProcNotation#to_s remove whitespace for nil output type #10935

Merged

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Jul 13, 2021

When a block parameter type restriction's output type is Nil, it prints as an empty output type ((->)). The formatter removes trailing whitespace in that case, while the ToSVisitor always adds whitespace. Thus there are two different formatting -> and ->.
This patch adjust the ToSVisitor to only add whitespace when the output type is not nil.

Changing the formatter to always add whitespace would equally be possible.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser labels Jul 13, 2021
@beta-ziliani beta-ziliani added this to the 1.2.0 milestone Jul 14, 2021
@straight-shoota straight-shoota merged commit 123e6f3 into crystal-lang:master Jul 23, 2021
@straight-shoota straight-shoota deleted the fix/proc_notation-to_s branch July 23, 2021 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants