Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/IRGen/TBDGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,16 @@ void TBDGenVisitor::addProtocolWitnessThunk(RootProtocolConformance *C,
ValueDecl *requirementDecl) {
Mangle::ASTMangler Mangler;

std::string decorated = Mangler.mangleWitnessThunk(C, requirementDecl);
// FIXME: We should have a SILDeclRef SymbolSource for this.
addSymbol(Mangler.mangleWitnessThunk(C, requirementDecl),
SymbolSource::forUnknown());
addSymbol(decorated, SymbolSource::forUnknown());

if (requirementDecl->isProtocolRequirement()) {
ValueDecl *PWT = C->getWitness(requirementDecl).getDecl();
if (const auto *AFD = dyn_cast<AbstractFunctionDecl>(PWT))
if (AFD->hasAsync())
addSymbol(decorated + "Tu", SymbolSource::forUnknown());
}
}

void TBDGenVisitor::addFirstFileSymbols() {
Expand Down
23 changes: 23 additions & 0 deletions test/IRGen/serialised-pwt-afp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -disable-availability-checking -emit-module -emit-module-path %t/P.swiftmodule -parse-as-library -module-name P -DP %s
// 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

// REQUIRES: concurrency

#if P
public protocol P {
func f() async
}
#else
import P

protocol Q: P { }

extension Q {
public func f() async { }
}

public struct S: Q {
public init() { }
}
#endif