Skip to content

Commit c83c0f4

Browse files
committed
Filter out invalid nested types from typealias override checking
The lookupDirect means that we can see type declarations nested inside of a protocol. If we do not filter these invalid declarations, we will offer a bogus fixit on top of a cycle diagnostic. Remove these types from consideration entirely so we don't crash and don't offer bogus fixits. Resolves rdar://57003317
1 parent 4cd873a commit c83c0f4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4102,6 +4102,10 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
41024102
auto type = dyn_cast<TypeDecl>(found);
41034103
if (!type || isa<AssociatedTypeDecl>(type)) continue;
41044104

4105+
// Ignore nominal types. They're always invalid declarations.
4106+
if (isa<NominalTypeDecl>(type))
4107+
continue;
4108+
41054109
// ... from the same module as the protocol.
41064110
if (type->getModuleContext() != proto->getModuleContext()) continue;
41074111

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
protocol Iteratee {
4+
associatedtype Iterator
5+
}
6+
7+
protocol BidirectionalAdvancingCollection: Iteratee {
8+
struct Iterator<Elements> {}
9+
}

0 commit comments

Comments
 (0)