Skip to content

Conversation

@phausler
Copy link
Contributor

@phausler phausler commented Aug 8, 2016

What's in this pull request?

The default implementation for comparable automatically adds >, >= etc by having == and < defined. Also the dynamic check for comparison of measurements that are convertible should traverse through the same runtime equality check instead of a static dispatch call out.

Additional conformance changes for Measurement and unit tests to verify comparison and equality.

After speaking with the current owner of Measurement, the most sensible path is to at runtime verifty the conformance of Units to a specific dimension since we cannot directly check at compile time. If at a future point in time a more specific comparitor can be added that can restrict the comparison to measurements in a specific dimension without causing equatable failures we may want to revisit this. However as it stands this preserves the most reasonable implementation of comparison of disperate measurement unit types while preserving the expected logic of conversions within that dimension.

Resolved bug number:

rdar://problem/27556581 Measurement type defines two '==' functions


The default implementation for comparable automatically adds >, >= etc by having == and < defined. Also the dynamic check for comparison of measurements that are convertible should traverse through the same runtime equality check instead of a static dispatch call out.

This resolves:
<rdar://problem/27556581> Measurement type defines two '==' functions
@tkremenek
Copy link
Member

@swift-ci test

@phausler phausler force-pushed the swift-3.0-branch_Measurement branch from 7a7b2ab to 9377089 Compare August 8, 2016 20:58
…fy comparison and equality

After speaking with the current owner of Measurement, the most sensible path is to at runtime verifty the conformance of Units to a specific dimension since we cannot directly check at compile time. If at a future point in time a more specific comparitor can be added that can restrict the comparison to measurements in a specific dimension without causing equatable failures we may want to revisit this. However as it stands this preserves the most reasonable implementation of comparison of disperate measurement unit types while preserving the expected logic of conversions within that dimension.
@phausler phausler force-pushed the swift-3.0-branch_Measurement branch from 9377089 to f4333dc Compare August 8, 2016 21:43
@tkremenek
Copy link
Member

@swift-ci test

@parkera
Copy link
Contributor

parkera commented Aug 9, 2016

The linux failure is unrelated, since this change only builds for Darwin. We should merge this now.

@ematejska ematejska merged commit 1534409 into swiftlang:swift-3.0-branch Aug 9, 2016
@phausler phausler mentioned this pull request Aug 9, 2016
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.

4 participants