Skip to content

[stdlib] Make _Unwrappable internal and rename func unwrap() to _unwrap() #20511

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 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions stdlib/public/core/BridgeObjectiveC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,12 @@ public func _extractDynamicValue<T>(_ value: T) -> AnyObject?
@_silgen_name("_swift_bridgeToObjectiveCUsingProtocolIfPossible")
public func _bridgeToObjectiveCUsingProtocolIfPossible<T>(_ value: T) -> AnyObject?

@usableFromInline
protocol _Unwrappable {
func unwrap() -> Any?
internal protocol _Unwrappable {
func _unwrap() -> Any?
}

extension Optional: _Unwrappable {
func unwrap() -> Any? {
internal func _unwrap() -> Any? {
return self
}
}
Expand Down Expand Up @@ -706,7 +705,7 @@ public func _bridgeAnythingToObjectiveC<T>(_ x: T) -> AnyObject {
}

if !done, let wrapper = source as? _Unwrappable {
if let value = wrapper.unwrap() {
if let value = wrapper._unwrap() {
result = value as AnyObject
} else {
result = _nullPlaceholder
Expand Down