Skip to content

Commit 71a516b

Browse files
committed
Print isolated conformances in textual interfaces
1 parent 0e873e7 commit 71a516b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,6 +2924,18 @@ void PrintAST::printInherited(const Decl *decl) {
29242924
Printer << "@unsafe ";
29252925
break;
29262926
}
2927+
2928+
if (auto globalActor = inherited.getGlobalActorIsolationType()) {
2929+
TypeLoc globalActorTL(globalActor->getTypeRepr(),
2930+
globalActor->getInstanceType());
2931+
Printer << "@";
2932+
printTypeLoc(globalActorTL);
2933+
Printer << " ";
2934+
}
2935+
2936+
if (inherited.isNonisolated())
2937+
Printer << "nonisolated ";
2938+
29272939
if (inherited.isSuppressed())
29282940
Printer << "~";
29292941
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %target-swift-frontend -typecheck -swift-version 6 -enable-library-evolution -module-name isolated_conformance -enable-experimental-feature IsolatedConformances -emit-module-interface-path - %s | %FileCheck %s
2+
3+
// REQUIRES: swift_feature_IsolatedConformances
4+
// REQUIRES: concurrency
5+
6+
public protocol MyProtocol {
7+
func f()
8+
}
9+
10+
@MainActor
11+
public class MyClass { }
12+
13+
// CHECK: extension isolated_conformance.MyClass : @MainActor isolated_conformance.MyProtocol {
14+
extension MyClass: @MainActor MyProtocol {
15+
@MainActor public func f() { }
16+
}

0 commit comments

Comments
 (0)