-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Gardening] Replaced many instances of ' : ' with ': ' #26218
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
Conversation
@@ -382,7 +382,7 @@ precedencegroup BitwiseShiftPrecedence { | |||
// Standard postfix operators. | |||
postfix operator ++ | |||
postfix operator -- | |||
postfix operator ... : Comparable | |||
postfix operator ...: Comparable |
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.
This section with the operators is the only place where I prefer having a space before the colon, but it's probably not worth the exception. Anyone else?
Otherwise LGTM! Thanks @twostraws!
@swift-ci Please smoke test |
Other than the quoted tweet, where are the other sources for adopting this coding style? I understand that in the definition of a variable (or property) type the omission of space is fair, but for dictionaries and similar cases this is not the ideal solution. They are different things and they have different semantics. |
@vmartinelli For some rationalization, see this old forum post: https://forums.swift.org/t/rfc-space-or-not-to-space/18657/5?u=lorentey At the end of the day, these are completely arbitrary choices. |
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.
Looks good. The edge cases are rare and we can always resolve them later. (Formatting when there is a line break around the colon & spacing in operator decls.)
@lorentey Thank you for the comment and the thread link. 🙂 ("At the end of the day, these are completely arbitrary choices": I could not find a better definition for certain recent Swift-related decisions.) |
Thanks @twostraws ! |
@vmartinelli this is not a helpful comment, please keep things constructive if you want to participate in discussions on PRs |
@airspeedswift Pardon. I did not mean to offend anyone. In fact, my post scriptum was not really addressed to everyone. It was meant only to the crazy ones. |
Following guidance from Karoy that the current stdlib style is not to put a space before most colons (https://twitter.com/lorentey/status/1151899985849417728?s=20), this PR adjusts many instances of " : " to be ": ".
There are two notable exceptions:
Use of the ternary operator is an entirely different context and has been left untouched.
Some instances of conformance are written such that the colon is the first thing on a new line. This wasn't common, but I can see this as being sufficiently different to be changed separately if at all.