swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.14k forks source link

Fix infinite loop when force casting NSError to CocoaError #5115

Closed nnabeyang closed 1 month ago

nnabeyang commented 1 month ago

This PR addresses an infinite loop issue that occurred when force casting NSError to CocoaError. The problem arose because _forceBridgeFromObjectiveC was calling _unconditionallyBridgeFromObjectiveC, and in turn, _unconditionallyBridgeFromObjectiveC was calling _forceBridgeFromObjectiveC, causing a recursive loop.

parkera commented 1 month ago

@swift-ci test

parkera commented 1 month ago

Thanks for this fix. We are strangely inconsistent about which bridging function is 'primary' for these types; sometimes it funnels to conditionally, sometimes unconditionally, sometimes none of the above.