Skip to content

[gardening][Measurement] Move operators into types #1349

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 1 commit into from
Nov 30, 2017

Conversation

ikesyo
Copy link
Member

@ikesyo ikesyo commented Nov 30, 2017

@ikesyo
Copy link
Member Author

ikesyo commented Nov 30, 2017

@swift-ci Please test

let lhsValueInTermsOfBase = lhs.unit.converter.baseUnitValue(fromValue: lhs.value)
let rhsValueInTermsOfBase = rhs.unit.converter.baseUnitValue(fromValue: rhs.value)
return Measurement(value: lhsValueInTermsOfBase - rhsValueInTermsOfBase, unit: type(of: lhs.unit).baseUnit())
extension Measurement where UnitType : Dimension {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that having a lot of new extensions is ideal. Could we move this inside the existing extension on line 47?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every single method seems to be in its own extension although some are using a conditional conformance so this is consistent. However maybe a followup PR could merge them so there are only two extensions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every single method seems to be in its own extension although some are using a conditional conformance so this is consistent. However maybe a followup PR could merge them so there are only two extensions.

Yep I'm going to do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK as long as this PR isn't the end then 👍

@ianpartridge
Copy link
Contributor

@swift-ci please test and merge

@swift-ci swift-ci merged commit e41c5e4 into swiftlang:master Nov 30, 2017
@ikesyo
Copy link
Member Author

ikesyo commented Nov 30, 2017

Thanks @ianpartridge and @spevans!

@ikesyo ikesyo deleted the measurement-operator-static-func branch November 30, 2017 15:41
@parkera
Copy link
Contributor

parkera commented Nov 30, 2017

I believe this code is also shared with the overlay.

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.

5 participants