Skip to content

[Foundation overlay] Enable custom AnyHashable representation for NSMeasurement #4793

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

Conversation

DougGregor
Copy link
Member

Enable custom AnyHashable representation for NSMeasurement

Resolves rdar://problem/27539951.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor
Copy link
Member Author

@gribozavr , do you mind taking a look?

unit: UnitLength.kilometers)
let ah = AnyHashable(measurement)
expectTrue(type(of: ah.base) is Measurement.Type)
}
Copy link
Contributor

@gribozavr gribozavr Sep 15, 2016

Choose a reason for hiding this comment

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

Please move the tests to test/stdlib/TestMeasurement.swift instead. Please follow the pattern in test_AnyHashableCreatedFromNSCalendar from test/stdlib/TestCalendar.swift.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, thanks!

@DougGregor DougGregor force-pushed the custom-anyhashable-nsmeasurement branch from 7aa3a7e to 87ab304 Compare September 15, 2016 05:21
…easurement

Enables the overlay behavior blocked by rdar://problem/27539951.
@DougGregor DougGregor force-pushed the custom-anyhashable-nsmeasurement branch from 87ab304 to fa4331b Compare September 15, 2016 05:22
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor
Copy link
Member Author

@gribozavr updated, thank you!

NSMeasurement(doubleValue: 100, unit: UnitLength.kilometers),
]
let anyHashables = values.map(AnyHashable.init)
expectEqual(Measurement.self, type(of: anyHashables[0].base))
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM with an explicit generic type parameter on Measurement in the assertion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do, thanks!

}

func test_AnyHashableCreatedFromNSMeasurement() {
if #available(iOS 8.0, *) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This availability check doesn't make sense to me - NSMeasurement is new in iOS 10 and OS X 10.12.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch; this whole test is already iOS 10/macOS 10.12. Fixed in a subsequent commit.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor DougGregor merged commit 605218d into swiftlang:master Sep 15, 2016
@DougGregor DougGregor deleted the custom-anyhashable-nsmeasurement branch September 15, 2016 16:33
aaditya-chandrasekhar pushed a commit to val-verde/swift that referenced this pull request Sep 30, 2022
[pull] swiftwasm-release/5.7 from release/5.7
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.

3 participants