Skip to content

Commit 6d77828

Browse files
authored
Merge pull request #19671 from itaiferber/foundation-minor-abi-cleanup
2 parents 5d4f3c8 + 96e167a commit 6d77828

File tree

9 files changed

+10
-407
lines changed

9 files changed

+10
-407
lines changed

Darwin/Foundation-swiftoverlay/Boxing.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,3 @@ extension _MutableBoxing {
6262
return whatToDo(_handle._pointer)
6363
}
6464
}
65-
66-
internal enum _MutableUnmanagedWrapper<ImmutableType : NSObject, MutableType : NSObject>
67-
where MutableType : NSMutableCopying{
68-
case Immutable(Unmanaged<ImmutableType>)
69-
case Mutable(Unmanaged<MutableType>)
70-
}

Darwin/Foundation-swiftoverlay/Decimal.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@_exported import Foundation // Clang module
1414
import _SwiftCoreFoundationOverlayShims
1515

16+
// The methods in this extension exist to match the protocol requirements of FloatinPoint, even if we can't conform directly.
17+
// If it becomes clear that conformance is truly impossible, we can deprecate some of the methods (e.g. isEqual(to:)) in favor of operators.
1618
extension Decimal {
1719
public typealias RoundingMode = NSDecimalNumber.RoundingMode
1820
public typealias CalculationError = NSDecimalNumber.CalculationError

Darwin/Foundation-swiftoverlay/NSCoder.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,3 @@ extension NSKeyedUnarchiver {
229229
}
230230
}
231231
}
232-
233-
234-
@available(*, deprecated, renamed:"NSCoding", message: "Please use NSCoding")
235-
typealias Coding = NSCoding
236-
237-
@available(*, deprecated, renamed:"NSCoder", message: "Please use NSCoder")
238-
typealias Coder = NSCoder
239-
240-
@available(*, deprecated, renamed:"NSKeyedUnarchiver", message: "Please use NSKeyedUnarchiver")
241-
typealias KeyedUnarchiver = NSKeyedUnarchiver
242-
243-
@available(*, deprecated, renamed:"NSKeyedArchiver", message: "Please use NSKeyedArchiver")
244-
typealias KeyedArchiver = NSKeyedArchiver

Darwin/Foundation-swiftoverlay/NSDictionary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extension Dictionary {
3434
///
3535
/// The provided `NSDictionary` will be copied to ensure that the copy can
3636
/// not be mutated by other code.
37-
public init(_cocoaDictionary: __shared _NSDictionary) {
37+
fileprivate init(_cocoaDictionary: __shared _NSDictionary) {
3838
assert(
3939
_isBridgedVerbatimToObjectiveC(Key.self) &&
4040
_isBridgedVerbatimToObjectiveC(Value.self),

Darwin/Foundation-swiftoverlay/NSGeometry.swift

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,15 @@ import CoreGraphics
2020
// NSRectEdge
2121
//===----------------------------------------------------------------------===//
2222

23-
// In the SDK, the following NS*Edge constants are defined as macros for the
24-
// corresponding CGRectEdge enumerators. Thus, in the SDK, NS*Edge constants
25-
// have CGRectEdge type. This is not correct for Swift (as there is no
26-
// implicit conversion to NSRectEdge).
27-
28-
@available(*, unavailable, renamed: "NSRectEdge.MinX")
29-
public var NSMinXEdge: NSRectEdge {
30-
fatalError("unavailable property can't be accessed")
31-
}
32-
@available(*, unavailable, renamed: "NSRectEdge.MinY")
33-
public var NSMinYEdge: NSRectEdge {
34-
fatalError("unavailable property can't be accessed")
35-
}
36-
@available(*, unavailable, renamed: "NSRectEdge.MaxX")
37-
public var NSMaxXEdge: NSRectEdge {
38-
fatalError("unavailable property can't be accessed")
39-
}
40-
@available(*, unavailable, renamed: "NSRectEdge.MaxY")
41-
public var NSMaxYEdge: NSRectEdge {
42-
fatalError("unavailable property can't be accessed")
43-
}
44-
4523
extension NSRectEdge {
24+
@inlinable
4625
public init(rectEdge: CGRectEdge) {
4726
self = NSRectEdge(rawValue: UInt(rectEdge.rawValue))!
4827
}
4928
}
5029

5130
extension CGRectEdge {
31+
@inlinable
5232
public init(rectEdge: NSRectEdge) {
5333
self = CGRectEdge(rawValue: UInt32(rectEdge.rawValue))!
5434
}

Darwin/Foundation-swiftoverlay/NSIndexSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@_exported import Foundation // Clang module
1414

15-
// FIXME: move inside NSIndexSet when the compiler supports this.
15+
// TODO: Evaluate deprecating with a message in favor of IndexSet.
1616
public struct NSIndexSetIterator : IteratorProtocol {
1717
public typealias Element = Int
1818

Darwin/Foundation-swiftoverlay/NSObject.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
@_exported import Foundation // Clang module
1414
import ObjectiveC
1515

16+
// This exists to allow for dynamic dispatch on KVO methods added to NSObject.
17+
// Extending NSObject with these methods would disallow overrides.
1618
public protocol _KeyValueCodingAndObserving {}
19+
extension NSObject : _KeyValueCodingAndObserving {}
1720

1821
public struct NSKeyValueObservedChange<Value> {
1922
public typealias Kind = NSKeyValueChange
@@ -230,5 +233,3 @@ extension _KeyValueCodingAndObserving {
230233
(self as! NSObject).didChangeValue(forKey: _bridgeKeyPathToString(keyPath), withSetMutation: mutation, using: set)
231234
}
232235
}
233-
234-
extension NSObject : _KeyValueCodingAndObserving {}

Darwin/Foundation-swiftoverlay/NSSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extension Set {
1717
///
1818
/// The provided `NSSet` will be copied to ensure that the copy can
1919
/// not be mutated by other code.
20-
public init(_cocoaSet: __shared _NSSet) {
20+
fileprivate init(_cocoaSet: __shared _NSSet) {
2121
assert(_isBridgedVerbatimToObjectiveC(Element.self),
2222
"Set can be backed by NSSet _variantStorage only when the member type can be bridged verbatim to Objective-C")
2323
// FIXME: We would like to call CFSetCreateCopy() to avoid doing an

0 commit comments

Comments
 (0)