Skip to content

Commit 882dc9e

Browse files
committed
Ensure that we print @sendable when printing TypeReprs.
Fixes rdar://85453819. (cherry picked from commit a6b586d)
1 parent ce25df6 commit 882dc9e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/AST/TypeRepr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ void AttributedTypeRepr::printAttrs(ASTPrinter &Printer,
183183
Printer.printSimpleAttr("@autoclosure") << " ";
184184
if (hasAttr(TAK_escaping))
185185
Printer.printSimpleAttr("@escaping") << " ";
186+
if (hasAttr(TAK_Sendable))
187+
Printer.printSimpleAttr("@Sendable") << " ";
186188
if (hasAttr(TAK_noDerivative))
187189
Printer.printSimpleAttr("@noDerivative") << " ";
188190

test/ModuleInterface/concurrency.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public func reasyncFn(_: () async -> ()) reasync {
1414
fatalError()
1515
}
1616

17+
@available(SwiftStdlib 5.5, *)
18+
public func takesSendable(
19+
_ block: @Sendable @escaping () async throws -> Void
20+
) { }
21+
1722
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency -I %t
1823

1924
#else
@@ -29,3 +34,7 @@ func callFn() async {
2934
// CHECK: // swift-module-flags:{{.*}} -enable-experimental-concurrency
3035
// CHECK: public func fn() async
3136
// CHECK: public func reasyncFn(_: () async -> ()) reasync
37+
// CHECK: public func takesSendable(_ block: @escaping @Sendable () async throws ->
38+
39+
// RUN: %target-swift-frontend -typecheck -enable-library-evolution -enable-experimental-concurrency -emit-module-interface-path %t/Library.swiftinterface -DLIBRARY -module-name Library %s -module-interface-preserve-types-as-written
40+
// RUN: %FileCheck %s <%t/Library.swiftinterface

0 commit comments

Comments
 (0)