mirror of
https://github.com/apple/swift.git
synced 2026-10-04 11:58:22 +02:00
If the specialized function is generic, the optimization derived the wrong error type when creating a thunk for the specialized function. Fixes a compiler crash https://github.com/swiftlang/swift/issues/89617 rdar://178484080
18 lines
522 B
Swift
18 lines
522 B
Swift
// RUN: %target-swift-frontend -module-name test -emit-sil -O %s | %FileCheck %s
|
|
|
|
public enum MyError<T>: Swift.Error { case fail }
|
|
|
|
// Check that function signature opt does not crash when remove the dead argument.
|
|
public func foo<T>(_ x: T) throws(MyError<T>) -> UInt8 {
|
|
throw .fail
|
|
}
|
|
|
|
// CHECK-LABEL: sil shared @$s4test3fooys5UInt8VxAA7MyErrorOyxGYKlFTf4d_n : $@convention(thin) <T> () -> (UInt8, @error MyError<T>) {
|
|
public func run<T>(_ x: T) -> UInt8 {
|
|
do {
|
|
return try foo(x)
|
|
} catch {
|
|
return 0
|
|
}
|
|
}
|