-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
proposing additions for type annotation #12076
Conversation
Proposing few examples on how to use whitespace for type annotations.
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.
Some minor changes, but otherwise this is great. Thanks @smoothdeveloper
thanks Co-Authored-By: smoothdeveloper <smoothdeveloper@users.noreply.github.com>
Co-Authored-By: smoothdeveloper <smoothdeveloper@users.noreply.github.com>
Co-Authored-By: smoothdeveloper <smoothdeveloper@users.noreply.github.com>
Co-Authored-By: smoothdeveloper <smoothdeveloper@users.noreply.github.com>
Co-Authored-By: smoothdeveloper <smoothdeveloper@users.noreply.github.com>
Co-Authored-By: smoothdeveloper <smoothdeveloper@users.noreply.github.com>
Co-Authored-By: smoothdeveloper <smoothdeveloper@users.noreply.github.com>
I've seen a lot of code with no space before colon in both values and function definitions, like this: // values:
let x: SomeType = y
let f () =
let y: AnotherType = g x
()
// functions:
let f (arg: _): unit =
()
let f x: unit =
() Perhaps, I've seen even more code formatted like this than with the space like in Also, having different styles for patterns that are parameters and head patterns in bindings adds a lot of confusion on how these should be formatted, since seemingly same things get formatted differently. @cartermp @dsyme I think we should explicitly allow this style, since Fantomas uses rules defined in this guide to enforce arguably less popular code style without any option to keep the no-space style. What do you think? |
Hmmm for me only the return type of functions should add whitespace before the let f (arg: _) : unit =
() This is partly so For values there should be no whitespace: let x: SomeType = y |
@auduchinok I made a proposed adjustment here: #24643 |
Proposing few examples on how to use whitespace for type annotations.