Skip to content

Commit 564f152

Browse files
authored
Merge pull request #64973 from compnerd/59-public-privates
TDBGen: add a workaround for a workaround for async PWT
2 parents 5fd4979 + 3394091 commit 564f152

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

lib/IRGen/TBDGen.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,16 @@ void TBDGenVisitor::addProtocolWitnessThunk(RootProtocolConformance *C,
472472
ValueDecl *requirementDecl) {
473473
Mangle::ASTMangler Mangler;
474474

475+
std::string decorated = Mangler.mangleWitnessThunk(C, requirementDecl);
475476
// FIXME: We should have a SILDeclRef SymbolSource for this.
476-
addSymbol(Mangler.mangleWitnessThunk(C, requirementDecl),
477-
SymbolSource::forUnknown());
477+
addSymbol(decorated, SymbolSource::forUnknown());
478+
479+
if (requirementDecl->isProtocolRequirement()) {
480+
ValueDecl *PWT = C->getWitness(requirementDecl).getDecl();
481+
if (const auto *AFD = dyn_cast<AbstractFunctionDecl>(PWT))
482+
if (AFD->hasAsync())
483+
addSymbol(decorated + "Tu", SymbolSource::forUnknown());
484+
}
478485
}
479486

480487
void TBDGenVisitor::addFirstFileSymbols() {

test/IRGen/serialised-pwt-afp.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -disable-availability-checking -emit-module -emit-module-path %t/P.swiftmodule -parse-as-library -module-name P -DP %s
3+
// RUN: %target-swift-frontend -disable-availability-checking -I%t -parse-as-library -module-name Q -c %s -o /dev/null -validate-tbd-against-ir=missing
4+
5+
// REQUIRES: concurrency
6+
7+
#if P
8+
public protocol P {
9+
func f() async
10+
}
11+
#else
12+
import P
13+
14+
protocol Q: P { }
15+
16+
extension Q {
17+
public func f() async { }
18+
}
19+
20+
public struct S: Q {
21+
public init() { }
22+
}
23+
#endif

0 commit comments

Comments
 (0)