Skip to content

Commit e29b10f

Browse files
committed
Prevent existential_requires_any error
1 parent 3b3e5a2 commit e29b10f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ static Type applyGenericArguments(Type type, TypeResolution resolution,
755755
// Build ParameterizedProtocolType if the protocol has a primary associated
756756
// type and we're in a supported context (for now just generic requirements,
757757
// inheritance clause, extension binding).
758-
if (resolution.getOptions().isConstraintImplicitExistential()) {
758+
if (resolution.getOptions().isConstraintImplicitExistential() && !ctx.LangOpts.hasFeature(Feature::ImplicitSome)) {
759759
diags.diagnose(loc, diag::existential_requires_any,
760760
protoDecl->getDeclaredInterfaceType(),
761761
protoDecl->getExistentialType(),
@@ -4686,7 +4686,7 @@ class ExistentialTypeVisitor
46864686

46874687
auto comp = T->getComponentRange().back();
46884688
if (auto *proto = dyn_cast_or_null<ProtocolDecl>(comp->getBoundDecl())) {
4689-
if (proto->existentialRequiresAny()) {
4689+
if (proto->existentialRequiresAny() && !Ctx.LangOpts.hasFeature(Feature::ImplicitSome)) {
46904690
Ctx.Diags.diagnose(comp->getNameLoc(),
46914691
diag::existential_requires_any,
46924692
proto->getDeclaredInterfaceType(),
@@ -4703,7 +4703,7 @@ class ExistentialTypeVisitor
47034703
if (type->isConstraintType()) {
47044704
auto layout = type->getExistentialLayout();
47054705
for (auto *protoDecl : layout.getProtocols()) {
4706-
if (!protoDecl->existentialRequiresAny())
4706+
if (!protoDecl->existentialRequiresAny() || Ctx.LangOpts.hasFeature(Feature::ImplicitSome))
47074707
continue;
47084708

47094709
Ctx.Diags.diagnose(comp->getNameLoc(),

0 commit comments

Comments
 (0)