Skip to content

[stdlib] Generalize array bridge/cast machinery #3560

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
Jul 18, 2016
Merged

Conversation

dabrahams
Copy link
Contributor

Now we support casting and bridging to/from [Any], not just [AnyObject]

Note that the typechecker still doesn't allow all the casts we'd like;
see the FIXMEs in test/1_stdlib/ArrayBridge.swift.gyb.

@dabrahams
Copy link
Contributor Author

@swift-ci Please test and merge

struct UnwrapFailure : Error {}
extension Optional {
internal func unwrappedOrError() throws -> Wrapped {
if self == nil { throw UnwrapFailure() }
Copy link
Contributor

@gribozavr gribozavr Jul 17, 2016

Choose a reason for hiding this comment

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

Why not

guard let unwrapped = self else { thrown UnwrapFailure() }
return unwrapped

... avoiding unsafe APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LGTM

@DougGregor
Copy link
Member

Sweet! @rjmccall has most of the type checker changes in place, IIRC

@dabrahams dabrahams force-pushed the id-as-any-stdlib branch 2 times, most recently from f09c294 to 46be0fc Compare July 18, 2016 20:08
Now we support casting and bridging to/from [Any], not just [AnyObject]

Note that the typechecker still doesn't allow all the casts we'd like;
see the FIXMEs in test/1_stdlib/ArrayBridge.swift.gyb.
@dabrahams
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit e98ddd6 into master Jul 18, 2016
@dabrahams dabrahams deleted the id-as-any-stdlib branch July 18, 2016 21:38
kateinoigakukun pushed a commit that referenced this pull request Aug 31, 2022
[pull] swiftwasm from main
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