File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 19
19
#include " swift/Sema/IterativeTypeChecker.h"
20
20
#include " swift/AST/ASTContext.h"
21
21
#include " swift/AST/Decl.h"
22
+ #include " swift/AST/ExistentialLayout.h"
22
23
#include < tuple>
23
24
using namespace swift ;
24
25
@@ -256,9 +257,12 @@ void IterativeTypeChecker::processInheritedProtocols(
256
257
// Collect existential types.
257
258
// FIXME: We'd prefer to keep what the user wrote here.
258
259
if (inherited.getType ()->isExistentialType ()) {
259
- SmallVector<ProtocolDecl *, 4 > protocols;
260
- inherited.getType ()->getExistentialTypeProtocols (protocols);
261
- for (auto inheritedProtocol: protocols) {
260
+ auto layout = inherited.getType ()->getExistentialLayout ();
261
+ assert (!layout.superclass && " Need to redo inheritance clause "
262
+ " typechecking" );
263
+ for (auto inheritedProtocolTy: layout.getProtocols ()) {
264
+ auto *inheritedProtocol = inheritedProtocolTy->getDecl ();
265
+
262
266
if (inheritedProtocol == protocol ||
263
267
inheritedProtocol->inheritsFrom (protocol)) {
264
268
if (!diagnosedCircularity) {
You can’t perform that action at this time.
0 commit comments