Skip to content

Commit a6b586d

Browse files
committed
Ensure that we print @sendable when printing TypeReprs.
Fixes rdar://85453819.
1 parent ae1f250 commit a6b586d

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
@@ -211,6 +211,8 @@ void AttributedTypeRepr::printAttrs(ASTPrinter &Printer,
211211
Printer.printSimpleAttr("@autoclosure") << " ";
212212
if (hasAttr(TAK_escaping))
213213
Printer.printSimpleAttr("@escaping") << " ";
214+
if (hasAttr(TAK_Sendable))
215+
Printer.printSimpleAttr("@Sendable") << " ";
214216
if (hasAttr(TAK_noDerivative))
215217
Printer.printSimpleAttr("@noDerivative") << " ";
216218

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)