Skip to content

Commit 78b337e

Browse files
committed
Sema: Remove TypeResolutionOptions::isParameterizedProtocolSupported()
It is the same as !isConstraintImplicitExistential()
1 parent 1e12d0a commit 78b337e

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ static Type applyGenericArguments(Type type, TypeResolution resolution,
692692
// Build ParameterizedProtocolType if the protocol has a primary associated
693693
// type and we're in a supported context (for now just generic requirements,
694694
// inheritance clause, extension binding).
695-
if (!resolution.getOptions().isParameterizedProtocolSupported()) {
695+
if (resolution.getOptions().isConstraintImplicitExistential()) {
696696
diags.diagnose(loc, diag::existential_requires_any,
697697
protoDecl->getDeclaredInterfaceType(),
698698
protoDecl->getExistentialType(),
@@ -4202,7 +4202,7 @@ TypeResolver::resolveCompositionType(CompositionTypeRepr *repr,
42024202
}
42034203

42044204
if (ty->is<ParameterizedProtocolType>() &&
4205-
options.isParameterizedProtocolSupported() &&
4205+
!options.isConstraintImplicitExistential() &&
42064206
options.getContext() != TypeResolverContext::ExistentialConstraint) {
42074207
HasProtocol = true;
42084208
Members.push_back(ty);

lib/Sema/TypeCheckType.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -300,43 +300,6 @@ class TypeResolutionOptions {
300300
}
301301
}
302302

303-
/// Whether parameterized protocol types are supported in this context.
304-
bool isParameterizedProtocolSupported() const {
305-
switch (context) {
306-
case Context::Inherited:
307-
case Context::ExtensionBinding:
308-
case Context::TypeAliasDecl:
309-
case Context::GenericTypeAliasDecl:
310-
case Context::GenericRequirement:
311-
case Context::ExistentialConstraint:
312-
case Context::MetatypeBase:
313-
return true;
314-
case Context::None:
315-
case Context::GenericArgument:
316-
case Context::ProtocolGenericArgument:
317-
case Context::TupleElement:
318-
case Context::InExpression:
319-
case Context::ExplicitCastExpr:
320-
case Context::ForEachStmt:
321-
case Context::PatternBindingDecl:
322-
case Context::EditorPlaceholderExpr:
323-
case Context::ClosureExpr:
324-
case Context::FunctionInput:
325-
case Context::VariadicFunctionInput:
326-
case Context::InoutFunctionInput:
327-
case Context::FunctionResult:
328-
case Context::SubscriptDecl:
329-
case Context::EnumElementDecl:
330-
case Context::EnumPatternPayload:
331-
case Context::SameTypeRequirement:
332-
case Context::ProtocolMetatypeBase:
333-
case Context::ImmediateOptionalTypeArgument:
334-
case Context::AbstractFunctionDecl:
335-
case Context::CustomAttr:
336-
return false;
337-
}
338-
}
339-
340303
/// Whether pack expansion types are supported in this context.
341304
bool isPackExpansionSupported() const {
342305
switch (context) {

0 commit comments

Comments
 (0)