Skip to content

Commit 7b66e96

Browse files
committed
Remove ASTPrinter hack for inferred Failure type alias
Now that we're proactively renaming this typealias on creation, this hack does nothing.
1 parent b944be2 commit 7b66e96

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5512,32 +5512,6 @@ void Decl::printInherited(ASTPrinter &Printer, const PrintOptions &Opts) const {
55125512
printer.printInherited(this);
55135513
}
55145514

5515-
/// Determine whether this typealias is an inferred typealias "Failure" that
5516-
/// would conflict with another entity named failure in the same type.
5517-
static bool isConflictingFailureTypeWitness(
5518-
const TypeAliasDecl *typealias) {
5519-
if (!typealias->isImplicit())
5520-
return false;
5521-
5522-
ASTContext &ctx = typealias->getASTContext();
5523-
if (typealias->getName() != ctx.Id_Failure)
5524-
return false;
5525-
5526-
auto nominal = typealias->getDeclContext()->getSelfNominalTypeDecl();
5527-
if (!nominal)
5528-
return false;
5529-
5530-
// Look for another entity with the same name.
5531-
auto lookupResults = nominal->lookupDirect(
5532-
typealias->getName(), typealias->getLoc());
5533-
for (auto found : lookupResults) {
5534-
if (found != typealias)
5535-
return true;
5536-
}
5537-
5538-
return false;
5539-
}
5540-
55415515
bool Decl::shouldPrintInContext(const PrintOptions &PO) const {
55425516
// Skip getters/setters. They are part of the variable or subscript.
55435517
if (isa<AccessorDecl>(this))
@@ -5577,14 +5551,6 @@ bool Decl::shouldPrintInContext(const PrintOptions &PO) const {
55775551
return PO.PrintIfConfig;
55785552
}
55795553

5580-
// Prior to Swift 6, we shouldn't print the inferred associated type
5581-
// witness for AsyncSequence.Failure. It is always determined from the
5582-
// AsyncIteratorProtocol witness.
5583-
if (auto typealias = dyn_cast<TypeAliasDecl>(this)) {
5584-
if (isConflictingFailureTypeWitness(typealias))
5585-
return false;
5586-
}
5587-
55885554
// Print everything else.
55895555
return true;
55905556
}

0 commit comments

Comments
 (0)