Skip to content

Commit f5fb8fe

Browse files
committed
Foundation: workaround the frontend trying to keep sugar
The compiler is working hard to keep the type sugar on the interface for even an internal interface. The type sugar being preserved causes a deserialization failure on Darwin. Use an equivalent local typealias to avoid the issue. SR-9811
1 parent a4c8860 commit f5fb8fe

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Foundation/NSLock.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ extension NSLock {
133133
open class NSConditionLock : NSObject, NSLocking {
134134
internal var _cond = NSCondition()
135135
internal var _value: Int
136-
internal var _thread: _CFThreadRef?
136+
internal var _thread: _swift_CFThreadRef?
137137

138138
public convenience override init() {
139139
self.init(condition: 0)

Foundation/Thread.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
import CoreFoundation
1111

12+
// WORKAROUND_SR9811
13+
#if os(Windows)
14+
internal typealias _swift_CFThreadRef = HANDLE
15+
#else
16+
internal typealias _swift_CFThreadRef = pthread_t
17+
#endif
18+
1219
internal class NSThreadSpecific<T: NSObject> {
1320
private var key = _CFThreadSpecificKeyCreate()
1421

@@ -178,7 +185,7 @@ open class Thread : NSObject {
178185
}
179186

180187
internal var _main: () -> Void = {}
181-
private var _thread: _CFThreadRef? = nil
188+
private var _thread: _swift_CFThreadRef? = nil
182189

183190
#if os(Windows) && !CYGWIN
184191
internal var _attr: _CFThreadAttributes =
@@ -194,7 +201,7 @@ open class Thread : NSObject {
194201

195202
open private(set) var threadDictionary: NSMutableDictionary = NSMutableDictionary()
196203

197-
internal init(thread: _CFThreadRef) {
204+
internal init(thread: _swift_CFThreadRef) {
198205
// Note: even on Darwin this is a non-optional _CFThreadRef; this is only used for valid threads, which are never null pointers.
199206
_thread = thread
200207
}

0 commit comments

Comments
 (0)