Skip to content

Foundation: resolve some warnings #16078

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
May 1, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion stdlib/public/SDK/Foundation/JSONEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,7 @@ extension _JSONDecoder {
debugDescription: "Invalid URL string."))
}

return url as! T
return (url as! T)
} else if type == Decimal.self || type == NSDecimalNumber.self {
return try self.unbox(value, as: Decimal.self) as? T
} else {
Expand Down
10 changes: 5 additions & 5 deletions stdlib/public/SDK/Foundation/NSObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ func _bridgeStringToKeyPath(_ keyPath:String) -> AnyKeyPath? {

public class NSKeyValueObservation : NSObject {

weak var object : NSObject?
let callback : (NSObject, NSKeyValueObservedChange<Any>) -> Void
let path : String
@nonobjc weak var object : NSObject?
@nonobjc let callback : (NSObject, NSKeyValueObservedChange<Any>) -> Void
@nonobjc let path : String

//workaround for <rdar://problem/31640524> Erroneous (?) error when using bridging in the Foundation overlay
static var swizzler : NSKeyValueObservation? = {
@nonobjc static var swizzler : NSKeyValueObservation? = {
let bridgeClass: AnyClass = NSKeyValueObservation.self
let observeSel = #selector(NSObject.observeValue(forKeyPath:of:change:context:))
let swapSel = #selector(NSKeyValueObservation._swizzle_me_observeValue(forKeyPath:of:change:context:))
Expand All @@ -157,7 +157,7 @@ public class NSKeyValueObservation : NSObject {
}

///invalidate() will be called automatically when an NSKeyValueObservation is deinited
public func invalidate() {
@objc public func invalidate() {
object?.removeObserver(self, forKeyPath: path, context: nil)
object = nil
}
Expand Down
2 changes: 0 additions & 2 deletions stdlib/public/SDK/Foundation/NSStringAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ extension StringProtocol where Index == String.Index {
// self can be a Substring so we need to subtract/add this offset when
// passing _ns to the Foundation APIs. Will be 0 if self is String.
@inlinable
@usableFromInline
internal var _substringOffset: Int {
return self.startIndex.encodedOffset
}
Expand All @@ -448,7 +447,6 @@ extension StringProtocol where Index == String.Index {
}

@inlinable
@usableFromInline
internal func _toRelativeNSRange(_ r: Range<String.Index>) -> NSRange {
return NSRange(
location: r.lowerBound.encodedOffset - _substringOffset,
Expand Down