Skip to content

Commit 592f015

Browse files
committed
Ensure that NSCharacterSet always returns an NSObject on copy (follow up to #5107)
rdar://138005684
1 parent 64ba207 commit 592f015

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Foundation/NSCharacterSet.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ open class NSCharacterSet : NSObject, NSCopying, NSMutableCopying, NSSecureCodin
371371

372372
open func copy(with zone: NSZone? = nil) -> Any {
373373
if type(of: self) == NSCharacterSet.self || type(of: self) == NSMutableCharacterSet.self {
374-
return _CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject)
374+
return _CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject)._nsObject
375375
} else if type(of: self) == _NSCFCharacterSet.self {
376-
return CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject) as Any
376+
return CFCharacterSetCreateCopy(kCFAllocatorSystemDefault, self._cfObject)._nsObject
377377
} else {
378378
NSRequiresConcreteImplementation()
379379
}

0 commit comments

Comments
 (0)