Skip to content

Commit 66ee83f

Browse files
authored
Merge pull request swiftlang#20393 from davezarzycki/AssociatedTypeDecl_assert
[AST] AssociatedTypeDecls cannot override itself
2 parents 3f3abfd + 614cb48 commit 66ee83f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/AST/Decl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,6 +3210,7 @@ AssociatedTypeDecl *AssociatedTypeDecl::getAssociatedTypeAnchor() const {
32103210
// Find the best anchor among the anchors of the overridden decls.
32113211
AssociatedTypeDecl *bestAnchor = nullptr;
32123212
for (auto assocType : overridden) {
3213+
assert(this != assocType && "AssociatedTypeDecl cannot override itself");
32133214
auto anchor = assocType->getAssociatedTypeAnchor();
32143215
if (!bestAnchor || compare(anchor, bestAnchor) < 0)
32153216
bestAnchor = anchor;

0 commit comments

Comments
 (0)