-
Notifications
You must be signed in to change notification settings - Fork 10.5k
replace singular statement ++/-- with += 1/-= 1 for integer variables #556
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
replace singular statement ++/-- with += 1/-= 1 for integer variables #556
Conversation
++matchIndex | ||
++needleIndex | ||
matchIndex += 1 | ||
needleIndex += 1 |
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 part does not compile on Linux:
swift/stdlib/private/StdlibUnittest/StdlibCoreExtras.swift:60:20: error: binary operator '+=' cannot be applied to operands of type 'String.UnicodeScalarView.Index' and 'Int'
When advancing something that is primarily an index, |
0302ecb
to
ebb0c3a
Compare
@gribozavr done. |
@dabrahams Ahah! It just happens so that after sed, I had to leave a lot of ++/-- statement unchanged because they are for Index types, which can't be operand of +=/-=. You just give me an idea for the next patch :P |
@gribozavr Thanks for checking with me. We'll track the performance of this change after it lands. I don't have any objections for committing this patch. |
replace singular statement ++/-- with += 1/-= 1 for integer variables
Is there any reason for the removal of these (extremely handy) operators, other than the (extremely debatable IMHO) ones exposed at Not to mention the fact that we’re not sure wether can have the same performance as (and the same applies for the — operator) If discussion can still be reopened I’d like to share my opinions on the “disadvantages” exposed in the previously linked change proposal.
-- Sponsor: |
@falcon03 You are welcome to send your arguments to [email protected]. |
[Stress tester XFails] Update XFails
I busted out sed and replaced all the one-line ++ and -- statements in Swift files, then filtered out the results gradually until all tests passed in "check-swift-all".
Please let me know if breaking this up to multiple commit/PR is more desirable.