Skip to content

Commit 614cb48

Browse files
committed
[AST] AssociatedTypeDecls cannot override itself
1 parent f2c4250 commit 614cb48

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)