mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IDE] Teach type checker about conditional conformance extensions.
Before conditional conformances, the archetypes in conformance extensions (i.e. extension Foo: SomeProtocol) were equivalent to those in the type decl, with the same protocol bounds and so on. The code for printing "synthesized" members relied on this fact. This commit teaches that code to deal with archetypes in the conditional conformance extension when required. Fixes rdar://problem/36553066 and SR-6930.
This commit is contained in:
@@ -129,21 +129,22 @@ public:
|
||||
assert(DeclUSRs.empty() && "unmatched printDeclLoc call ?");
|
||||
}
|
||||
|
||||
|
||||
void printSynthesizedExtensionPre(const ExtensionDecl *ED,
|
||||
const NominalTypeDecl *Target,
|
||||
TypeOrExtensionDecl Target,
|
||||
Optional<BracketOptions> Bracket) override {
|
||||
// When we start print a synthesized extension, record the target's USR.
|
||||
llvm::SmallString<64> Buf;
|
||||
llvm::raw_svector_ostream OS(Buf);
|
||||
if (!SwiftLangSupport::printUSR(Target, OS)) {
|
||||
auto TargetNTD = Target.getBaseNominal();
|
||||
if (!SwiftLangSupport::printUSR(TargetNTD, OS)) {
|
||||
TargetUSR = OS.str();
|
||||
}
|
||||
}
|
||||
|
||||
void printSynthesizedExtensionPost(const ExtensionDecl *ED,
|
||||
const NominalTypeDecl *Target,
|
||||
Optional<BracketOptions> Bracket) override {
|
||||
void
|
||||
printSynthesizedExtensionPost(const ExtensionDecl *ED,
|
||||
TypeOrExtensionDecl Target,
|
||||
Optional<BracketOptions> Bracket) override {
|
||||
// When we leave a synthesized extension, clear target's USR.
|
||||
TargetUSR = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user