mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #63701 from tshortli/main-actor-missing-on-closure-param
AST: Print the custom attributes attached to `AttributedTypeRepr`
This commit is contained in:
@@ -218,6 +218,15 @@ void AttributedTypeRepr::printAttrs(ASTPrinter &Printer,
|
|||||||
Printer.printSimpleAttr("@autoclosure") << " ";
|
Printer.printSimpleAttr("@autoclosure") << " ";
|
||||||
if (hasAttr(TAK_escaping))
|
if (hasAttr(TAK_escaping))
|
||||||
Printer.printSimpleAttr("@escaping") << " ";
|
Printer.printSimpleAttr("@escaping") << " ";
|
||||||
|
|
||||||
|
for (auto customAttr : Attrs.getCustomAttrs()) {
|
||||||
|
Printer.callPrintStructurePre(PrintStructureKind::BuiltinAttribute);
|
||||||
|
Printer << "@";
|
||||||
|
customAttr->getTypeRepr()->print(Printer, Options);
|
||||||
|
Printer.printStructurePost(PrintStructureKind::BuiltinAttribute);
|
||||||
|
Printer << " ";
|
||||||
|
}
|
||||||
|
|
||||||
if (hasAttr(TAK_Sendable))
|
if (hasAttr(TAK_Sendable))
|
||||||
Printer.printSimpleAttr("@Sendable") << " ";
|
Printer.printSimpleAttr("@Sendable") << " ";
|
||||||
if (hasAttr(TAK_noDerivative))
|
if (hasAttr(TAK_noDerivative))
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ public func takesSendable(
|
|||||||
_ block: @Sendable @escaping () async throws -> Void
|
_ block: @Sendable @escaping () async throws -> Void
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
@available(SwiftStdlib 5.5, *)
|
||||||
|
public func takesMainActor(
|
||||||
|
_ block: @MainActor @escaping () -> Void
|
||||||
|
) { }
|
||||||
|
|
||||||
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency -I %t
|
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency -I %t
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -31,12 +36,13 @@ func callFn() async {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// RUN: %FileCheck %s <%t/Library.swiftinterface
|
// RUN: %FileCheck %s < %t/Library.swiftinterface
|
||||||
// CHECK: // swift-module-flags:{{.*}} -enable-experimental-concurrency
|
// CHECK: // swift-module-flags:{{.*}} -enable-experimental-concurrency
|
||||||
// CHECK: public func fn() async
|
// CHECK: public func fn() async
|
||||||
// CHECK: public func reasyncFn(_: () async -> ()) reasync
|
// CHECK: public func reasyncFn(_: () async -> ()) reasync
|
||||||
// CHECK: public func takesSendable(_ block: @escaping @Sendable () async throws ->
|
// CHECK: public func takesSendable(_ block: @escaping @Sendable () async throws ->
|
||||||
|
// CHECK: public func takesMainActor(_ block: @escaping @{{_Concurrency.MainActor|MainActor}} () ->
|
||||||
|
|
||||||
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -enable-experimental-concurrency -DLIBRARY -module-name Library -module-interface-preserve-types-as-written
|
// RUN: %target-swift-emit-module-interface(%t/LibraryPreserveTypesAsWritten.swiftinterface) %s -enable-experimental-concurrency -DLIBRARY -module-name LibraryPreserveTypesAsWritten -module-interface-preserve-types-as-written
|
||||||
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -enable-experimental-concurrency
|
// RUN: %target-swift-typecheck-module-from-interface(%t/LibraryPreserveTypesAsWritten.swiftinterface) -enable-experimental-concurrency
|
||||||
// RUN: %FileCheck %s <%t/Library.swiftinterface
|
// RUN: %FileCheck %s < %t/LibraryPreserveTypesAsWritten.swiftinterface
|
||||||
|
|||||||
Reference in New Issue
Block a user