Files
swift-mirror/validation-test/compiler_crashers_fixed/rdar81590807_2.swift
Hamish Knight 4e811c3a88 [test] Merge crasher directories
There is no longer much of a good reason to keep these separate,
merge them.
2025-10-18 12:51:30 +01:00

47 lines
1.3 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-clang %S/Inputs/rdar81590807_2.m -I %S/Inputs -c -o %t/rdar81590807_2.o
// RUN: %target-build-swift -Xfrontend -disable-availability-checking -import-objc-header %S/Inputs/rdar81590807_2.h -Xlinker %t/rdar81590807_2.o -parse-as-library %s -o %t/main
// RUN: %target-codesign %t/main
// RUN: %target-run %t/main | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: OS=macosx || OS=ios
// rdar://82123254
// UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime
func run(on object: PFXObject) async throws {
// CHECK: syncSuccess
print("\(try await object.findAnswerSyncSuccess())\n")
// CHECK: asyncSuccess
print("\(try await object.findAnswerAsyncSuccess())\n")
do {
try await object.findAnswerSyncFail()
// CHECK-NOT: oh no syncFail
print("\("oh no syncFail")\n")
}
catch let error {
// CHECK: Error Domain=syncFail Code=1 "(null)"
print("\(error)\n")
}
do {
try await object.findAnswerAsyncFail()
// CHECK-NOT: oh no asyncFail
print("\("oh no asyncFail")\n")
}
catch let error {
// CHECK: Error Domain=asyncFail Code=2 "(null)"
print("\(error)\n")
}
// CHECK: <<>>
print("<<\(try await object.findAnswerIncorrect())>>\n")
}
@main struct Main {
static func main() async throws {
let object = PFXObject()
try await run(on: object)
}
}