swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.34k forks source link

Crash in Swift package using `Swift.Result` in generic functions when used from Xcode project on latest Apple OS's #69162

Open kdubb opened 11 months ago

kdubb commented 11 months ago

Description

Swift package that uses Swift.Result in a generic function crashes when used in an Xcode project (Application or Framework) on macOS 14, iOS 17, tvOS 17 but works correctly when used from Swift Test Target on same platforms.

Steps to reproduce

  1. Clone https://github.com/outfoxx/Kubrick repo
  2. Checkout BRANCH repro/result-crash
  3. Open KubricKHost/KubrickHost.xcodeproj
  4. Select iOS Simulator with iOS 17 OS.
  5. Run MapJobTests.test_MappingValuesToResults test to see crash

Expected behavior

The code should work from both Swift packages and Xcode projects on all versions of Apple OS's.

Environment

swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1) Target: arm64-apple-macosx14.0

Xcode 15.0 Build version 15A240d

Failing deployment targets: macOS 14.x.x iOS 17.x.x tvOS 17.x.x

Succeeding deployment targets: macOS 13.x.x iOS 16.x.x tvOS 16.x.x

kdubb commented 11 months ago

Understand that I spent considerable time trying to build a "small" reproducing project to no avail. In the end I figured I would file the issue with the broken Swift package and an easy method to reproduce it.

kdubb commented 11 months ago

More details...

Replacing Swift.Result with a similar enum defined in the project (ExecuteResult) removes the crash. This can be seen in the repo's main branch.