Skip to content

Commit 16a5e04

Browse files
committed
[SILGen] Enable protocol extension version of _unconditionallyBridgeToObjectiveC
1 parent 1534c84 commit 16a5e04

File tree

2 files changed

+4
-37
lines changed

2 files changed

+4
-37
lines changed

lib/SILGen/SILGenBridging.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ emitBridgeObjectiveCToNative(SILGenFunction &gen,
131131
// Compute the substitutions.
132132
substitutions = valueTypeBGT->getSubstitutions(gen.SGM.SwiftModule,
133133
nullptr);
134+
} else {
135+
// FIXME: We should always be using these substitutions, but they
136+
// aren't reliable with specialized conformances.
137+
substitutions = witness.getSubstitutions();
134138
}
135139

136140
// Substitute into the witness function type.

stdlib/public/SDK/Foundation/Foundation.swift

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,6 @@ extension Int : _ObjectiveCBridgeable {
213213
self._forceBridgeFromObjectiveC(x, result: &result)
214214
return true
215215
}
216-
217-
public static func _unconditionallyBridgeFromObjectiveC(
218-
source: NSNumber?
219-
) -> Int {
220-
return source!.integerValue
221-
}
222216
}
223217

224218
extension UInt : _ObjectiveCBridgeable {
@@ -253,12 +247,6 @@ extension UInt : _ObjectiveCBridgeable {
253247
self._forceBridgeFromObjectiveC(x, result: &result)
254248
return true
255249
}
256-
257-
public static func _unconditionallyBridgeFromObjectiveC(
258-
source: NSNumber?
259-
) -> UInt {
260-
return source!.unsignedIntegerValue
261-
}
262250
}
263251

264252
extension Float : _ObjectiveCBridgeable {
@@ -293,12 +281,6 @@ extension Float : _ObjectiveCBridgeable {
293281
self._forceBridgeFromObjectiveC(x, result: &result)
294282
return true
295283
}
296-
297-
public static func _unconditionallyBridgeFromObjectiveC(
298-
source: NSNumber?
299-
) -> Float {
300-
return source!.floatValue
301-
}
302284
}
303285

304286
extension Double : _ObjectiveCBridgeable {
@@ -333,12 +315,6 @@ extension Double : _ObjectiveCBridgeable {
333315
self._forceBridgeFromObjectiveC(x, result: &result)
334316
return true
335317
}
336-
337-
public static func _unconditionallyBridgeFromObjectiveC(
338-
source: NSNumber?
339-
) -> Double {
340-
return source!.doubleValue
341-
}
342318
}
343319

344320
extension Bool: _ObjectiveCBridgeable {
@@ -373,12 +349,6 @@ extension Bool: _ObjectiveCBridgeable {
373349
self._forceBridgeFromObjectiveC(x, result: &result)
374350
return true
375351
}
376-
377-
public static func _unconditionallyBridgeFromObjectiveC(
378-
source: NSNumber?
379-
) -> Bool {
380-
return source!.boolValue
381-
}
382352
}
383353

384354
// CGFloat bridging.
@@ -416,13 +386,6 @@ extension CGFloat : _ObjectiveCBridgeable {
416386
self._forceBridgeFromObjectiveC(x, result: &result)
417387
return true
418388
}
419-
420-
public static func _unconditionallyBridgeFromObjectiveC(
421-
source: NSNumber?
422-
) -> CGFloat {
423-
return CGFloat(
424-
CGFloat.NativeType._unconditionallyBridgeFromObjectiveC(source))
425-
}
426389
}
427390

428391
// Literal support for NSNumber

0 commit comments

Comments
 (0)