Skip to content

Commit 5d68459

Browse files
committed
---
yaml --- r: 343549 b: refs/heads/master-rebranch c: 666c000 h: refs/heads/master i: 343547: 989f9d6
1 parent f2282ef commit 5d68459

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14551455
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14561456
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14571457
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1458-
refs/heads/master-rebranch: ab1184208a1fee3637ad97e0d3c4175606071ddd
1458+
refs/heads/master-rebranch: 666c000607214d1fb42b4157e468e78b9d0bb779
14591459
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14601460
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14611461
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec

branches/master-rebranch/lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "TypoCorrection.h"
2121
#include "swift/AST/ASTContext.h"
2222
#include "swift/AST/Decl.h"
23+
#include "swift/AST/ExistentialLayout.h"
2324
#include "swift/AST/Expr.h"
2425
#include "swift/AST/GenericSignature.h"
2526
#include "swift/AST/Initializer.h"
@@ -2452,12 +2453,7 @@ bool ContextualFailure::tryProtocolConformanceFixIt(
24522453
// is a struct), then bail out instead of offering a broken fix-it later on.
24532454
auto requiresClass = false;
24542455
if (unwrappedToType->isExistentialType()) {
2455-
if (auto protocolTy = unwrappedToType->getAs<ProtocolType>()) {
2456-
requiresClass = protocolTy->requiresClass();
2457-
} else if (auto compositionTy =
2458-
unwrappedToType->getAs<ProtocolCompositionType>()) {
2459-
requiresClass = compositionTy->requiresClass();
2460-
}
2456+
requiresClass = unwrappedToType->getExistentialLayout().requiresClass();
24612457
}
24622458
if (requiresClass && !FromType->is<ClassType>()) {
24632459
return false;
@@ -2486,7 +2482,6 @@ bool ContextualFailure::tryProtocolConformanceFixIt(
24862482
missingProtoTypeStrings.push_back(memberTy->getString());
24872483
}
24882484
}
2489-
24902485
// If we don't conform to all of the protocols in the composition, then
24912486
// store the composition type only. This is because we need to append
24922487
// 'Foo & Bar' instead of 'Foo, Bar' in order to match the written type.

0 commit comments

Comments
 (0)