Skip to content

Commit f7bb041

Browse files
authored
Remove 'public' from a few NSError-bridging-related symbols (#14731)
We're still using most of this, but not all of it has to be public. rdar://problem/35230025
1 parent 2866f0e commit f7bb041

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

stdlib/public/SDK/Foundation/NSError.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ public typealias NSErrorPointer = AutoreleasingUnsafeMutablePointer<NSError?>?
2424
// Note: NSErrorPointer becomes ErrorPointer in Swift 3.
2525
public typealias ErrorPointer = NSErrorPointer
2626

27-
public // COMPILER_INTRINSIC
28-
let _nilObjCError: Error = _GenericObjCError.nilError
27+
// An error value to use when an Objective-C API indicates error
28+
// but produces a nil error object.
29+
// This is 'internal' rather than 'private' for no other reason but to make the
30+
// type print more nicely. It's not part of the ABI, so if type printing of
31+
// private things improves we can change it.
32+
internal enum _GenericObjCError : Error {
33+
case nilError
34+
}
35+
// A cached instance of the above in order to save on the conversion to Error.
36+
private let _nilObjCError: Error = _GenericObjCError.nilError
2937

3038
public // COMPILER_INTRINSIC
3139
func _convertNSErrorToError(_ error: NSError?) -> Error {
@@ -335,12 +343,6 @@ extension CFError : Error {
335343
}
336344
}
337345

338-
// An error value to use when an Objective-C API indicates error
339-
// but produces a nil error object.
340-
public enum _GenericObjCError : Error {
341-
case nilError
342-
}
343-
344346
/// An internal protocol to represent Swift error enums that map to standard
345347
/// Cocoa NSError domains.
346348
public protocol _ObjectiveCBridgeableError : Error {

test/Inputs/clang-importer-sdk/swift-modules-without-ns/Foundation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ extension NSError : Error {
169169
public var _code: Int { return code }
170170
}
171171

172-
public enum _GenericObjCError : Error {
172+
internal enum _GenericObjCError : Error {
173173
case nilError
174174
}
175175

test/Inputs/clang-importer-sdk/swift-modules/Foundation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ extension NSError : Error {
230230
public var _code: Int { return code }
231231
}
232232

233-
public enum _GenericObjCError : Error {
233+
internal enum _GenericObjCError : Error {
234234
case nilError
235235
}
236236

0 commit comments

Comments
 (0)