Skip to content

[SR-6785] Fix Decimal conformance to Strideable #3066

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

Merged
merged 2 commits into from
Aug 30, 2021

Conversation

xwu
Copy link
Contributor

@xwu xwu commented Aug 28, 2021

Consider the following discrepancy:

import Foundation

let x: Int = 42
x.distance(to: 43) // 1
let y: Decimal = 42
y.distance(to: 43) // -1 (oops!)

The implementation of distance(to:) is incorrect for Decimal. This PR corrects the implementation (for both the overlay and swift-corelibs) and adds corresponding tests.

Resolves SR-6785.

@xwu xwu requested a review from spevans August 28, 2021 18:54
@xwu
Copy link
Contributor Author

xwu commented Aug 28, 2021

@swift-ci test

@xwu xwu changed the title [SR-6785] Fix conformance of Decimal to Strideable. [SR-6785] Fix conformance of Decimal to Strideable Aug 28, 2021
@xwu xwu force-pushed the decimal-distance branch from ede8723 to afbb0af Compare August 28, 2021 21:44
@xwu
Copy link
Contributor Author

xwu commented Aug 28, 2021

@swift-ci test

@xwu xwu changed the title [SR-6785] Fix conformance of Decimal to Strideable [SR-6785] Fix Decimal conformance to Strideable Aug 29, 2021
@xwu
Copy link
Contributor Author

xwu commented Aug 29, 2021

@swift-ci please test Linux

@xwu
Copy link
Contributor Author

xwu commented Aug 29, 2021

@swift-ci test

@xwu xwu merged commit 944987e into swiftlang:main Aug 30, 2021
@xwu xwu deleted the decimal-distance branch August 30, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants