Files
swift-mirror/test/SourceKit/InterfaceGen/gen_objc_concurrency.swift
Hamish Knight c19359af57 [test] Add additional test case for rdar://76685011
Make sure we don't print the @completionHandlerAsync
attr in the doc info.
2021-05-20 16:35:43 +01:00

21 lines
1.5 KiB
Swift

// REQUIRES: objc_interop
// REQUIRES: concurrency
// RUN: %empty-directory(%t)
// RUN: %sourcekitd-test -req=interface-gen %S/../Inputs/concurrency/gen_concurrency.swift -- %S/../Inputs/concurrency/gen_concurrency.swift -target %target-triple -I %t -Xfrontend -enable-experimental-concurrency | %FileCheck %s --check-prefix=SWIFT-GEN-INTERFACE
// Make sure we print @completionHandlerAsync when it was explicitly written by the user.
// SWIFT-GEN-INTERFACE-LABEL: class ClassWithAsyncAndHandler {
// SWIFT-GEN-INTERFACE: @completionHandlerAsync("foo(_:)", completionHandlerIndex: 1)
// SWIFT-GEN-INTERFACE-NEXT: internal func foo(_ operation: String, completionHandler handler: @escaping (Int) -> Void)
// SWIFT-GEN-INTERFACE: internal func foo(_ operation: String) async -> Int
// RUN: %sourcekitd-test -req=interface-gen -using-swift-args -header %S/../Inputs/concurrency/header_concurrency.h -- %s -Xfrontend -enable-objc-interop -Xfrontend -enable-experimental-concurrency -import-objc-header %S/../Inputs/concurrency/header_concurrency.h -sdk %clang-importer-sdk | %FileCheck %s --check-prefix=OBJC-GEN-INTERFACE
// But don't print @completionHandlerAsync if it was implicitly added to an imported Clang decl (rdar://76685011).
// OBJC-GEN-INTERFACE-LABEL: class ClassWithHandlerMethod {
// OBJC-GEN-INTERFACE-NOT: @completionHandlerAsync
// OBJC-GEN-INTERFACE: func method(withHandler operation: String!, completionHandler handler: ((Int) -> Void)!)
// OBJC-GEN-INTERFACE: func method(withHandler operation: String!) async -> Int