-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[stdlib] Implement SE-0233 AdditiveArithmetic #20422
Conversation
@swift-ci please smoke test |
@swift-ci please test |
@swift-ci please test source compatibility |
Build failed |
Build failed |
//===----------------------------------------------------------------------===// | ||
|
||
public protocol AdditiveArithmetic : Equatable { | ||
/// The zero value. |
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.
Can we expand this comment with a note that zero
is the name of the additive identity? Something like
/// zero is the identity element for addition; for any value x,x + .zero == x
and .zero + x == x
.
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.
Done. There's still no doc comment on the protocol itself, but writing good doc comments would take time :) I added TODO
's for that.
LGTM aside from minor documentation request. If tests pass, I'm fine with merging as is and adjusting documentation in follow-on patch. |
@swift-ci please test performance |
@swift-ci please smoke test |
@swift-ci please test performance |
@swift-ci please test source compatibility |
4bdd2fe
to
b788e55
Compare
@swift-ci please test |
Build failed |
@swift-ci please test os x platform |
Build failed |
Not sure why CI says "Build timed out (after 60 minutes)". @shahmishal |
/// example: | ||
/// | ||
/// 1 + 2 // 3 | ||
/// -10 + 15 // 5 |
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.
Examples involving the unary negative operator should probably be removed from the documentation for this protocol.
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.
Sure, but it was originally on Numeric
, and Numeric
did not have -
either. I'd like for this PR to focus on the implementation (to unblock @stephentyrone's SIMD PR, for example), and write a separate patch to refine documentation.
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.
Right. @xwu, can you open a SR bug for this (since we would want to consider it on Numeric
anyway) and CC me and @natecook1000?
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.
We are looking into why LLDB test suite. |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please benchmark |
@swift-ci please test compiler performance |
Build comment file: |
oh, duh, can't run the benchmarks until the conflicts are resolved, sorry |
@swift-ci please benchmark |
1 similar comment
@swift-ci please benchmark |
@swift-ci please test compiler performance |
Build comment file: |
@swift-ci please test |
Build failed |
Build failed |
Build comment file:Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
How to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please smoke test |
@swift-ci please smoke test os x |
@swift-ci please smoke test and merge |
This broke the source compat suite:
…hm. That's a valid error. |
Can we at least update the proposal to explain the migration path?
This is clearly not true, because conditional conformances don't imply conformance to refined protocols. It's not even clear to me how one would go about implementing this conformance in a way that works with both 4.2 and 5.0. |
Thanks for the tip. It was not clear to me. Given that it passed the core team review, it wasn't clear to other folks either. Could you please suggest a way to fix this? If there's no possible fix, I'll be happy to explain the migration path and update the compatibility suite. |
This PR implements proposal SE-0233: Make
Numeric
Refine a newAdditiveArithmetic
Protocol.