diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index c5e274733c7..b3cfae0728e 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -2780,8 +2780,8 @@ ERROR(inheritance_from_non_protocol_or_class,none, "inheritance from non-protocol, non-class type %0", (Type)) ERROR(inheritance_from_non_protocol,none, "inheritance from non-protocol type %0", (Type)) -ERROR(inheritance_from_parametrized_protocol,none, - "cannot inherit from parametrized protocol type %0", (Type)) +ERROR(inheritance_from_parameterized_protocol,none, + "cannot inherit from protocol type with generic argument %0", (Type)) ERROR(superclass_not_first,none, "superclass %0 must appear first in the inheritance clause", (Type)) ERROR(superclass_not_open,none, @@ -3723,7 +3723,7 @@ ERROR(not_a_generic_definition,none, "cannot specialize a non-generic definition", ()) ERROR(not_a_generic_type,none, "cannot specialize non-generic type %0", (Type)) -ERROR(parametrized_protocol_not_supported,none, +ERROR(parameterized_protocol_not_supported,none, "protocol type with generic argument can only be used as a generic constraint", ()) ERROR(protocol_does_not_have_primary_assoc_type,none, "cannot specialize protocol type %0", (Type)) diff --git a/include/swift/AST/ExistentialLayout.h b/include/swift/AST/ExistentialLayout.h index e4dd68b82c2..8f7548c013c 100644 --- a/include/swift/AST/ExistentialLayout.h +++ b/include/swift/AST/ExistentialLayout.h @@ -42,7 +42,7 @@ struct ExistentialLayout { ExistentialLayout(ProtocolType *type); ExistentialLayout(ProtocolCompositionType *type); - ExistentialLayout(ParametrizedProtocolType *type); + ExistentialLayout(ParameterizedProtocolType *type); /// The explicit superclass constraint, if any. Type explicitSuperclass; @@ -116,7 +116,7 @@ private: ArrayRef protocols; /// Zero or more primary associated type requirements from a - /// ParametrizedProtocolType + /// ParameterizedProtocolType ArrayRef sameTypeRequirements; }; diff --git a/include/swift/AST/TypeDifferenceVisitor.h b/include/swift/AST/TypeDifferenceVisitor.h index 435e0d7bda5..61d0e9170fe 100644 --- a/include/swift/AST/TypeDifferenceVisitor.h +++ b/include/swift/AST/TypeDifferenceVisitor.h @@ -339,8 +339,8 @@ public: type1->getMembers(), type2->getMembers()); } - bool visitParametrizedProtocolType(CanParametrizedProtocolType type1, - CanParametrizedProtocolType type2) { + bool visitParameterizedProtocolType(CanParameterizedProtocolType type1, + CanParameterizedProtocolType type2) { if (asImpl().visit(type1.getBaseType(), type2.getBaseType())) return true; diff --git a/include/swift/AST/TypeMatcher.h b/include/swift/AST/TypeMatcher.h index a9078db1d8e..e59acb5416d 100644 --- a/include/swift/AST/TypeMatcher.h +++ b/include/swift/AST/TypeMatcher.h @@ -305,20 +305,20 @@ class TypeMatcher { TRIVIAL_CASE(SILBoxType) TRIVIAL_CASE(ProtocolCompositionType) - bool visitParametrizedProtocolType(CanParametrizedProtocolType firstParametrizedProto, - Type secondType, - Type sugaredFirstType) { - if (auto secondParametrizedProto = secondType->getAs()) { + bool visitParameterizedProtocolType(CanParameterizedProtocolType firstParametrizedProto, + Type secondType, + Type sugaredFirstType) { + if (auto secondParametrizedProto = secondType->getAs()) { if (!this->visit(firstParametrizedProto.getBaseType(), secondParametrizedProto->getBaseType(), - sugaredFirstType->castTo() + sugaredFirstType->castTo() ->getBaseType())) { return false; } return this->visit(firstParametrizedProto.getArgumentType(), secondParametrizedProto->getArgumentType(), - sugaredFirstType->castTo() + sugaredFirstType->castTo() ->getArgumentType()); } diff --git a/include/swift/AST/TypeNodes.def b/include/swift/AST/TypeNodes.def index 473ef2a5ddd..6ab521153e6 100644 --- a/include/swift/AST/TypeNodes.def +++ b/include/swift/AST/TypeNodes.def @@ -161,7 +161,7 @@ ARTIFICIAL_TYPE(SILBlockStorage, Type) ARTIFICIAL_TYPE(SILBox, Type) ARTIFICIAL_TYPE(SILToken, Type) TYPE(ProtocolComposition, Type) -TYPE(ParametrizedProtocol, Type) +TYPE(ParameterizedProtocol, Type) TYPE(Existential, Type) TYPE(LValue, Type) TYPE(InOut, Type) diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index 8f181695663..10f1672d4b4 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -5243,7 +5243,7 @@ private: BEGIN_CAN_TYPE_WRAPPER(ProtocolCompositionType, Type) END_CAN_TYPE_WRAPPER(ProtocolCompositionType, Type) -/// ParametrizedProtocolType - A type that constrains the primary associated +/// ParameterizedProtocolType - A type that constrains the primary associated /// type of a protocol to an argument type. /// /// Written like a bound generic type, eg Sequence. @@ -5259,7 +5259,7 @@ END_CAN_TYPE_WRAPPER(ProtocolCompositionType, Type) /// \code /// T : Sequence where T.Element == Int. /// \endcode -class ParametrizedProtocolType final : public TypeBase, +class ParameterizedProtocolType final : public TypeBase, public llvm::FoldingSetNode { friend struct ExistentialLayout; @@ -5294,18 +5294,18 @@ public: // Implement isa/cast/dyncast/etc. static bool classof(const TypeBase *T) { - return T->getKind() == TypeKind::ParametrizedProtocol; + return T->getKind() == TypeKind::ParameterizedProtocol; } private: - ParametrizedProtocolType(const ASTContext *ctx, - ProtocolType *base, Type arg, - RecursiveTypeProperties properties); + ParameterizedProtocolType(const ASTContext *ctx, + ProtocolType *base, Type arg, + RecursiveTypeProperties properties); }; -BEGIN_CAN_TYPE_WRAPPER(ParametrizedProtocolType, Type) +BEGIN_CAN_TYPE_WRAPPER(ParameterizedProtocolType, Type) PROXY_CAN_TYPE_SIMPLE_GETTER(getBaseType) PROXY_CAN_TYPE_SIMPLE_GETTER(getArgumentType) -END_CAN_TYPE_WRAPPER(ParametrizedProtocolType, Type) +END_CAN_TYPE_WRAPPER(ParameterizedProtocolType, Type) /// An existential type, spelled with \c any . /// diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index db2311bee4a..82338940c99 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -321,9 +321,9 @@ namespace swift { /// keyword. bool EnableExplicitExistentialTypes = true; - /// Enable support for protocol types parametrized by primary + /// Enable support for protocol types parameterized by primary /// associated type. - bool EnableParametrizedProtocolTypes = false; + bool EnableParameterizedProtocolTypes = false; /// Enable experimental flow-sensitive concurrent captures. bool EnableExperimentalFlowSensitiveConcurrentCaptures = false; diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td index 9c2cb0edef1..6053fdc03ba 100644 --- a/include/swift/Option/FrontendOptions.td +++ b/include/swift/Option/FrontendOptions.td @@ -517,9 +517,9 @@ def enable_explicit_existential_types : Flag<["-"], "enable-explicit-existential-types">, HelpText<"Enable experimental support for explicit existential types">; -def enable_parametrized_protocol_types : - Flag<["-"], "enable-parametrized-protocol-types">, - HelpText<"Enable experimental support for primary associated types and parametrized protocols">; +def enable_parameterized_protocol_types : + Flag<["-"], "enable-parameterized-protocol-types">, + HelpText<"Enable experimental support for primary associated types and parameterized protocols">; def enable_deserialization_recovery : Flag<["-"], "enable-deserialization-recovery">, diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 2fa6849f4c3..294d4d5e66f 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -405,7 +405,7 @@ struct ASTContext::Implementation { llvm::FoldingSet UnboundGenericTypes; llvm::FoldingSet BoundGenericTypes; llvm::FoldingSet ProtocolCompositionTypes; - llvm::FoldingSet ParametrizedProtocolTypes; + llvm::FoldingSet ParameterizedProtocolTypes; llvm::FoldingSet LayoutConstraints; llvm::DenseMap, GenericEnvironment *> OpaqueArchetypeEnvironments; @@ -3404,9 +3404,9 @@ ProtocolCompositionType::build(const ASTContext &C, ArrayRef Members, return compTy; } -Type ParametrizedProtocolType::get(const ASTContext &C, - ProtocolType *baseTy, - Type argTy) { +Type ParameterizedProtocolType::get(const ASTContext &C, + ProtocolType *baseTy, + Type argTy) { bool isCanonical = baseTy->isCanonical(); RecursiveTypeProperties properties = baseTy->getRecursiveProperties(); properties |= argTy->getRecursiveProperties(); @@ -3416,16 +3416,16 @@ Type ParametrizedProtocolType::get(const ASTContext &C, void *InsertPos = nullptr; llvm::FoldingSetNodeID ID; - ParametrizedProtocolType::Profile(ID, baseTy, argTy); + ParameterizedProtocolType::Profile(ID, baseTy, argTy); if (auto paramTy - = C.getImpl().getArena(arena).ParametrizedProtocolTypes + = C.getImpl().getArena(arena).ParameterizedProtocolTypes .FindNodeOrInsertPos(ID, InsertPos)) return paramTy; - auto paramTy = new (C, arena) ParametrizedProtocolType( + auto paramTy = new (C, arena) ParameterizedProtocolType( isCanonical ? &C : nullptr, baseTy, argTy, properties); - C.getImpl().getArena(arena).ParametrizedProtocolTypes.InsertNode( + C.getImpl().getArena(arena).ParameterizedProtocolTypes.InsertNode( paramTy, InsertPos); return paramTy; } diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index ede3639f612..6c6770382c3 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -3942,9 +3942,9 @@ namespace { PrintWithColorRAII(OS, ParenthesisColor) << ')'; } - void visitParametrizedProtocolType(ParametrizedProtocolType *T, - StringRef label) { - printCommon(label, "parametrized_protocol_type"); + void visitParameterizedProtocolType(ParameterizedProtocolType *T, + StringRef label) { + printCommon(label, "parameterized_protocol_type"); printRec("base", T->getBaseType()); printRec("arg", T->getArgumentType()); PrintWithColorRAII(OS, ParenthesisColor) << ')'; diff --git a/lib/AST/ASTMangler.cpp b/lib/AST/ASTMangler.cpp index 94650e70ee7..a41f10cc78a 100644 --- a/lib/AST/ASTMangler.cpp +++ b/lib/AST/ASTMangler.cpp @@ -1266,7 +1266,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig, return appendExistentialLayout(layout, sig, forDecl); } - case TypeKind::ParametrizedProtocol: { + case TypeKind::ParameterizedProtocol: { llvm::errs() << "Not implemented\n"; abort(); } diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index 4aba6966e90..7b927f4dd55 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -5921,7 +5921,7 @@ public: } } - void visitParametrizedProtocolType(ParametrizedProtocolType *T) { + void visitParameterizedProtocolType(ParameterizedProtocolType *T) { visit(T->getBaseType()); Printer << "<"; visit(T->getArgumentType()); diff --git a/lib/AST/GenericSignatureBuilder.cpp b/lib/AST/GenericSignatureBuilder.cpp index 979ea400418..8c0b6c5601d 100644 --- a/lib/AST/GenericSignatureBuilder.cpp +++ b/lib/AST/GenericSignatureBuilder.cpp @@ -4502,7 +4502,7 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement( // Check whether we have a reasonable constraint type at all. if (!constraintType->is() && !constraintType->is() && - !constraintType->is() && + !constraintType->is() && !constraintType->getClassOrBoundGenericClass()) { if (source.getLoc().isValid() && !constraintType->hasError()) { Impl->HadAnyError = true; @@ -4516,7 +4516,7 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement( } // Parametrized protocol requirements. - if (auto *paramProtoType = constraintType->getAs()) { + if (auto *paramProtoType = constraintType->getAs()) { bool anyErrors = false; auto *protoDecl = paramProtoType->getBaseType()->getDecl(); diff --git a/lib/AST/RequirementMachine/RequirementLowering.cpp b/lib/AST/RequirementMachine/RequirementLowering.cpp index 33fdb5ba309..dd9f1e5c2f0 100644 --- a/lib/AST/RequirementMachine/RequirementLowering.cpp +++ b/lib/AST/RequirementMachine/RequirementLowering.cpp @@ -133,7 +133,7 @@ static void desugarConformanceRequirement(Type subjectType, Type constraintType, return; } - if (auto *paramType = constraintType->getAs()) { + if (auto *paramType = constraintType->getAs()) { auto *protoDecl = paramType->getBaseType()->getDecl(); desugarConformanceRequirement(subjectType, paramType->getBaseType(), @@ -214,7 +214,7 @@ static void realizeTypeRequirement(Type subjectType, Type constraintType, if (constraintType->is() || constraintType->is() || - constraintType->is()) { + constraintType->is()) { // Handle conformance requirements. desugarConformanceRequirement(subjectType, constraintType, reqs); } else if (constraintType->getClassOrBoundGenericClass()) { diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index ed20b031f36..1ee23e5d59d 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -191,8 +191,8 @@ bool CanType::isReferenceTypeImpl(CanType type, const GenericSignatureImpl *sig, return cast(type)->requiresClass(); case TypeKind::ProtocolComposition: return cast(type)->requiresClass(); - case TypeKind::ParametrizedProtocol: - return cast(type)->getBaseType()->requiresClass(); + case TypeKind::ParameterizedProtocol: + return cast(type)->getBaseType()->requiresClass(); case TypeKind::Existential: return isReferenceTypeImpl(cast(type).getConstraintType(), sig, functionsCount); @@ -295,7 +295,7 @@ ExistentialLayout::ExistentialLayout(ProtocolCompositionType *type) { protocols = { members.data(), members.size() }; } -ExistentialLayout::ExistentialLayout(ParametrizedProtocolType *type) { +ExistentialLayout::ExistentialLayout(ParameterizedProtocolType *type) { assert(type->isCanonical()); *this = ExistentialLayout(type->getBaseType()); @@ -319,7 +319,7 @@ ExistentialLayout CanType::getExistentialLayout() { if (auto proto = dyn_cast(*this)) return ExistentialLayout(proto); - if (auto param = dyn_cast(*this)) + if (auto param = dyn_cast(*this)) return ExistentialLayout(param); auto comp = cast(*this); @@ -1553,12 +1553,12 @@ CanType TypeBase::computeCanonicalType() { Result = Composition.getPointer(); break; } - case TypeKind::ParametrizedProtocol: { - auto *PPT = cast(this); + case TypeKind::ParameterizedProtocol: { + auto *PPT = cast(this); auto Base = cast(PPT->getBaseType()->getCanonicalType()); auto Arg = PPT->getArgumentType()->getCanonicalType(); auto &C = Base->getASTContext(); - Result = ParametrizedProtocolType::get(C, Base, Arg).getPointer(); + Result = ParameterizedProtocolType::get(C, Base, Arg).getPointer(); break; } case TypeKind::Existential: { @@ -3873,20 +3873,20 @@ void ProtocolCompositionType::Profile(llvm::FoldingSetNodeID &ID, ID.AddPointer(T.getPointer()); } -ParametrizedProtocolType::ParametrizedProtocolType( +ParameterizedProtocolType::ParameterizedProtocolType( const ASTContext *ctx, ProtocolType *base, Type arg, RecursiveTypeProperties properties) - : TypeBase(TypeKind::ParametrizedProtocol, /*Context=*/ctx, properties), + : TypeBase(TypeKind::ParameterizedProtocol, /*Context=*/ctx, properties), Base(base), AssocType(base->getDecl()->getPrimaryAssociatedType()), Arg(arg) { assert(AssocType != nullptr && "Protocol doesn't have a primary associated type"); } -void ParametrizedProtocolType::Profile(llvm::FoldingSetNodeID &ID, - ProtocolType *baseTy, - Type argTy) { +void ParameterizedProtocolType::Profile(llvm::FoldingSetNodeID &ID, + ProtocolType *baseTy, + Type argTy) { ID.AddPointer(baseTy); ID.AddPointer(argTy.getPointer()); } @@ -5676,8 +5676,8 @@ case TypeKind::Id: pc->hasExplicitAnyObject()); } - case TypeKind::ParametrizedProtocol: { - auto *ppt = cast(base); + case TypeKind::ParameterizedProtocol: { + auto *ppt = cast(base); Type base = ppt->getBaseType(); Type arg = ppt->getArgumentType(); @@ -5700,7 +5700,7 @@ case TypeKind::Id: if (!anyChanged) return *this; - return ParametrizedProtocolType::get( + return ParameterizedProtocolType::get( Ptr->getASTContext(), substBase->castTo(), substArg); @@ -5863,8 +5863,8 @@ ReferenceCounting TypeBase::getReferenceCounting() { return ReferenceCounting::Unknown; } - case TypeKind::ParametrizedProtocol: { - return cast(this) + case TypeKind::ParameterizedProtocol: { + return cast(this) ->getBaseType() ->getReferenceCounting(); } diff --git a/lib/AST/TypeWalker.cpp b/lib/AST/TypeWalker.cpp index ff83cd3ee1e..1f597866aee 100644 --- a/lib/AST/TypeWalker.cpp +++ b/lib/AST/TypeWalker.cpp @@ -174,7 +174,7 @@ class Traversal : public TypeVisitor return false; } - bool visitParametrizedProtocolType(ParametrizedProtocolType *ty) { + bool visitParameterizedProtocolType(ParameterizedProtocolType *ty) { if (doIt(ty->getBaseType())) return true; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 977f784a2ca..5b5d361fce5 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -451,8 +451,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, Opts.EnableExplicitExistentialTypes |= Args.hasArg(OPT_enable_explicit_existential_types); - Opts.EnableParametrizedProtocolTypes |= - Args.hasArg(OPT_enable_parametrized_protocol_types); + Opts.EnableParameterizedProtocolTypes |= + Args.hasArg(OPT_enable_parameterized_protocol_types); Opts.EnableExperimentalDistributed |= Args.hasArg(OPT_enable_experimental_distributed); diff --git a/lib/IRGen/Fulfillment.cpp b/lib/IRGen/Fulfillment.cpp index 3d8ec4c27b1..310b0e9f009 100644 --- a/lib/IRGen/Fulfillment.cpp +++ b/lib/IRGen/Fulfillment.cpp @@ -103,7 +103,7 @@ static bool isLeafTypeMetadata(CanType type) { return false; // Parametrized protocols have component types. - case TypeKind::ParametrizedProtocol: + case TypeKind::ParameterizedProtocol: return false; // Existential types have constraint types. diff --git a/lib/IRGen/GenExistential.cpp b/lib/IRGen/GenExistential.cpp index 3b152419dec..dce38ade0e5 100644 --- a/lib/IRGen/GenExistential.cpp +++ b/lib/IRGen/GenExistential.cpp @@ -1557,7 +1557,7 @@ TypeConverter::convertProtocolCompositionType(ProtocolCompositionType *T) { } const TypeInfo * -TypeConverter::convertParametrizedProtocolType(ParametrizedProtocolType *T) { +TypeConverter::convertParameterizedProtocolType(ParameterizedProtocolType *T) { return createExistentialTypeInfo(IGM, CanType(T)); } diff --git a/lib/IRGen/GenType.cpp b/lib/IRGen/GenType.cpp index 08f2dad965f..56b4c538681 100644 --- a/lib/IRGen/GenType.cpp +++ b/lib/IRGen/GenType.cpp @@ -2182,8 +2182,8 @@ const TypeInfo *TypeConverter::convertType(CanType ty) { return convertProtocolType(cast(ty)); case TypeKind::ProtocolComposition: return convertProtocolCompositionType(cast(ty)); - case TypeKind::ParametrizedProtocol: - return convertParametrizedProtocolType(cast(ty)); + case TypeKind::ParameterizedProtocol: + return convertParameterizedProtocolType(cast(ty)); case TypeKind::Existential: return convertExistentialType(cast(ty)); case TypeKind::GenericTypeParam: diff --git a/lib/IRGen/GenType.h b/lib/IRGen/GenType.h index d3dc6b1a846..41fae15ab3a 100644 --- a/lib/IRGen/GenType.h +++ b/lib/IRGen/GenType.h @@ -163,7 +163,7 @@ private: const TypeInfo *convertModuleType(ModuleType *T); const TypeInfo *convertProtocolType(ProtocolType *T); const TypeInfo *convertProtocolCompositionType(ProtocolCompositionType *T); - const TypeInfo *convertParametrizedProtocolType(ParametrizedProtocolType *T); + const TypeInfo *convertParameterizedProtocolType(ParameterizedProtocolType *T); const TypeInfo *convertExistentialType(ExistentialType *T); const LoadableTypeInfo *convertBuiltinNativeObject(); const LoadableTypeInfo *convertBuiltinUnknownObject(); diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index a442b6205c2..6f22a35e427 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -1477,7 +1477,7 @@ private: case TypeKind::Existential: case TypeKind::ProtocolComposition: - case TypeKind::ParametrizedProtocol: { + case TypeKind::ParameterizedProtocol: { auto *Decl = DbgTy.getDecl(); auto L = getFilenameAndLocation(*this, Decl); auto *File = getOrCreateFile(L.filename); diff --git a/lib/IRGen/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index f2e5fd6a4ab..866f806390f 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -1741,8 +1741,8 @@ namespace { } MetadataResponse - visitParametrizedProtocolType(CanParametrizedProtocolType type, - DynamicMetadataRequest request) { + visitParameterizedProtocolType(CanParameterizedProtocolType type, + DynamicMetadataRequest request) { return emitExistentialTypeMetadata(type, request); } diff --git a/lib/SIL/IR/TypeLowering.cpp b/lib/SIL/IR/TypeLowering.cpp index 8d7ceb6a0a5..adb9533f1c3 100644 --- a/lib/SIL/IR/TypeLowering.cpp +++ b/lib/SIL/IR/TypeLowering.cpp @@ -579,9 +579,9 @@ namespace { IsTypeExpansionSensitive_t isSensitive) { return visitExistentialType(type, origType, isSensitive); } - RetTy visitParametrizedProtocolType(CanParametrizedProtocolType type, - AbstractionPattern origType, - IsTypeExpansionSensitive_t isSensitive) { + RetTy visitParameterizedProtocolType(CanParameterizedProtocolType type, + AbstractionPattern origType, + IsTypeExpansionSensitive_t isSensitive) { return visitExistentialType(type, origType, isSensitive); } diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 57ece64ea4d..972f188295d 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -7007,7 +7007,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType, case TypeKind::Struct: case TypeKind::Protocol: case TypeKind::ProtocolComposition: - case TypeKind::ParametrizedProtocol: + case TypeKind::ParameterizedProtocol: case TypeKind::Existential: case TypeKind::BoundGenericEnum: case TypeKind::BoundGenericStruct: @@ -7024,7 +7024,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType, case TypeKind::Existential: case TypeKind::ExistentialMetatype: case TypeKind::ProtocolComposition: - case TypeKind::ParametrizedProtocol: + case TypeKind::ParameterizedProtocol: case TypeKind::Protocol: return coerceExistential(expr, toType); diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 4a9935ce33f..4f0c5d2fa2f 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -5815,7 +5815,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind, case TypeKind::Existential: case TypeKind::ProtocolComposition: - case TypeKind::ParametrizedProtocol: + case TypeKind::ParameterizedProtocol: switch (kind) { case ConstraintKind::Equal: case ConstraintKind::Bind: @@ -6453,7 +6453,7 @@ ConstraintSystem::simplifyConstructionConstraint( case TypeKind::SequenceArchetype: case TypeKind::DynamicSelf: case TypeKind::ProtocolComposition: - case TypeKind::ParametrizedProtocol: + case TypeKind::ParameterizedProtocol: case TypeKind::Protocol: case TypeKind::Existential: // Break out to handle the actual construction below. diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index a22701fd890..377021718fd 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -2786,7 +2786,7 @@ ExtendedTypeRequest::evaluate(Evaluator &eval, ExtensionDecl *ext) const { // Cannot extend function types, tuple types, etc. if (!extendedType->getAnyNominal() && - !extendedType->is()) { + !extendedType->is()) { diags.diagnose(ext->getLoc(), diag::non_nominal_extension, extendedType) .highlight(extendedRepr->getSourceRange()); return error(); diff --git a/lib/Sema/TypeCheckDeclPrimary.cpp b/lib/Sema/TypeCheckDeclPrimary.cpp index 01189f03634..0b304d2e397 100644 --- a/lib/Sema/TypeCheckDeclPrimary.cpp +++ b/lib/Sema/TypeCheckDeclPrimary.cpp @@ -249,9 +249,9 @@ static void checkInheritanceClause( inheritedTy = layout.explicitSuperclass; } - if (inheritedTy->is()) { + if (inheritedTy->is()) { if (!isa(decl)) { - decl->diagnose(diag::inheritance_from_parametrized_protocol, + decl->diagnose(diag::inheritance_from_parameterized_protocol, inheritedTy); } continue; diff --git a/lib/Sema/TypeCheckGeneric.cpp b/lib/Sema/TypeCheckGeneric.cpp index 8c2fb6349da..9a46bc8bbda 100644 --- a/lib/Sema/TypeCheckGeneric.cpp +++ b/lib/Sema/TypeCheckGeneric.cpp @@ -230,7 +230,7 @@ OpaqueResultTypeRequest::evaluate(Evaluator &evaluator, if (!constraintType->getClassOrBoundGenericClass() && !constraintType->is() && !constraintType->is() && - !constraintType->is()) { + !constraintType->is()) { ctx.Diags.diagnose(currentRepr->getLoc(), diag::opaque_type_invalid_constraint); return nullptr; @@ -528,10 +528,10 @@ static Type formExtensionInterfaceType( if (type->is()) type = type->getCanonicalType(); - // A parametrized protocol type is not a nominal. Unwrap it to get + // A parameterized protocol type is not a nominal. Unwrap it to get // the underlying nominal, and record a same-type requirement for // the primary associated type. - if (auto *paramProtoTy = type->getAs()) { + if (auto *paramProtoTy = type->getAs()) { auto *protoTy = paramProtoTy->getBaseType(); type = protoTy; diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 7e14108dcc9..81bfe689630 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -624,13 +624,13 @@ static Type applyGenericArguments(Type type, TypeResolution resolution, auto &ctx = dc->getASTContext(); auto &diags = ctx.Diags; - if (ctx.LangOpts.EnableParametrizedProtocolTypes) { + if (ctx.LangOpts.EnableParameterizedProtocolTypes) { if (auto *protoType = type->getAs()) { - // Build ParametrizedProtocolType if the protocol has a primary associated + // Build ParameterizedProtocolType if the protocol has a primary associated // type and we're in a supported context (for now just generic requirements, // inheritance clause, extension binding). - if (!resolution.getOptions().isParametrizedProtocolSupported()) { - diags.diagnose(loc, diag::parametrized_protocol_not_supported); + if (!resolution.getOptions().isParameterizedProtocolSupported()) { + diags.diagnose(loc, diag::parameterized_protocol_not_supported); return ErrorType::get(ctx); } @@ -658,7 +658,7 @@ static Type applyGenericArguments(Type type, TypeResolution resolution, if (!argTy || argTy->hasError()) return ErrorType::get(ctx); - return ParametrizedProtocolType::get(ctx, protoType, argTy); + return ParameterizedProtocolType::get(ctx, protoType, argTy); } } diff --git a/lib/Sema/TypeCheckType.h b/lib/Sema/TypeCheckType.h index 6ec1bb5bf73..90fd27c82f1 100644 --- a/lib/Sema/TypeCheckType.h +++ b/lib/Sema/TypeCheckType.h @@ -276,8 +276,8 @@ public: } } - /// Whether parametrized protocol types are supported in this context. - bool isParametrizedProtocolSupported() const { + /// Whether parameterized protocol types are supported in this context. + bool isParameterizedProtocolSupported() const { switch (context) { case Context::Inherited: case Context::ExtensionBinding: diff --git a/lib/Serialization/DeclTypeRecordNodes.def b/lib/Serialization/DeclTypeRecordNodes.def index 9dcd5a503e3..b932a378eb3 100644 --- a/lib/Serialization/DeclTypeRecordNodes.def +++ b/lib/Serialization/DeclTypeRecordNodes.def @@ -94,7 +94,7 @@ TYPE(OPAQUE_ARCHETYPE) TYPE(NESTED_ARCHETYPE) TYPE(SEQUENCE_ARCHETYPE) TYPE(PROTOCOL_COMPOSITION) -TYPE(PARAMETRIZED_PROTOCOL) +TYPE(PARAMETERIZED_PROTOCOL) TYPE(EXISTENTIAL) TYPE(BOUND_GENERIC) diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index aadc38a211b..3c7d69b60f5 100644 --- a/lib/Serialization/Deserialization.cpp +++ b/lib/Serialization/Deserialization.cpp @@ -5620,13 +5620,13 @@ public: return ProtocolCompositionType::get(ctx, protocols, hasExplicitAnyObject); } - Expected deserializeParametrizedProtocolType(ArrayRef scratch, - StringRef blobData) { + Expected deserializeParameterizedProtocolType(ArrayRef scratch, + StringRef blobData) { uint64_t baseTyID, argTyID; - decls_block::ParametrizedProtocolTypeLayout::readRecord(scratch, - baseTyID, argTyID); + decls_block::ParameterizedProtocolTypeLayout::readRecord(scratch, + baseTyID, argTyID); auto baseTy = MF.getTypeChecked(baseTyID); if (!baseTy) @@ -5636,7 +5636,7 @@ public: if (!argTy) return argTy.takeError(); - return ParametrizedProtocolType::get( + return ParameterizedProtocolType::get( ctx, (*baseTy)->castTo(), *argTy); } diff --git a/lib/Serialization/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index 01ac09bd107..073307b5dd1 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -1105,8 +1105,8 @@ namespace decls_block { BCArray // protocols >; - using ParametrizedProtocolTypeLayout = BCRecordLayout< - PARAMETRIZED_PROTOCOL_TYPE, + using ParameterizedProtocolTypeLayout = BCRecordLayout< + PARAMETERIZED_PROTOCOL_TYPE, TypeIDField, // base TypeIDWithBitField // argument >; diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 5dd3c136731..80106917ae0 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -4723,12 +4723,12 @@ public: } void - visitParametrizedProtocolType(const ParametrizedProtocolType *type) { + visitParameterizedProtocolType(const ParameterizedProtocolType *type) { using namespace decls_block; unsigned abbrCode = - S.DeclTypeAbbrCodes[ParametrizedProtocolTypeLayout::Code]; - ParametrizedProtocolTypeLayout::emitRecord( + S.DeclTypeAbbrCodes[ParameterizedProtocolTypeLayout::Code]; + ParameterizedProtocolTypeLayout::emitRecord( S.Out, S.ScratchRecord, abbrCode, S.addTypeRef(type->getBaseType()), S.addTypeRef(type->getArgumentType())); diff --git a/test/type/opaque_parameters.swift b/test/type/opaque_parameters.swift index 2776dca4bd4..06adac1caf3 100644 --- a/test/type/opaque_parameters.swift +++ b/test/type/opaque_parameters.swift @@ -1,4 +1,4 @@ -// RUN: %target-typecheck-verify-swift -enable-experimental-opaque-parameters -enable-parametrized-protocol-types -disable-availability-checking +// RUN: %target-typecheck-verify-swift -enable-experimental-opaque-parameters -enable-parameterized-protocol-types -disable-availability-checking protocol P { } diff --git a/test/type/parametrized_protocol.swift b/test/type/parameterized_protocol.swift similarity index 80% rename from test/type/parametrized_protocol.swift rename to test/type/parameterized_protocol.swift index 79526ee008d..894dc5dda9d 100644 --- a/test/type/parametrized_protocol.swift +++ b/test/type/parameterized_protocol.swift @@ -1,6 +1,6 @@ -// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=verify -requirement-machine-inferred-signatures=verify -enable-parametrized-protocol-types -disable-availability-checking +// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=verify -requirement-machine-inferred-signatures=verify -enable-parameterized-protocol-types -disable-availability-checking -// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=verify -enable-parametrized-protocol-types -requirement-machine-inferred-signatures=verify -disable-availability-checking 2>&1 | %FileCheck %s +// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=verify -enable-parameterized-protocol-types -requirement-machine-inferred-signatures=verify -disable-availability-checking 2>&1 | %FileCheck %s protocol Sequence { @@ -19,38 +19,38 @@ struct ConcreteEquatableSequence : EquatableSequence {} /// Parametrized protocol in protocol inheritance clause -// CHECK-LABEL: parametrized_protocol.(file).IntSequence@ +// CHECK-LABEL: parameterized_protocol.(file).IntSequence@ // CHECK: Requirement signature: protocol IntSequence : Sequence {} -/// Concrete types cannot inherit from a parametrized protocol +/// Concrete types cannot inherit from a parameterized protocol struct SillyStruct : Sequence {} -// expected-error@-1 {{cannot inherit from parametrized protocol type 'Sequence'}} +// expected-error@-1 {{cannot inherit from protocol type with generic argument 'Sequence'}} // expected-error@-2 {{type 'SillyStruct' does not conform to protocol 'Sequence'}} /// Parametrized protocol in generic parameter inheritance clause -// CHECK-LABEL: parametrized_protocol.(file).IntSequenceWrapper@ +// CHECK-LABEL: parameterized_protocol.(file).IntSequenceWrapper@ // CHECK: Generic signature: struct IntSequenceWrapper> {} -// CHECK-LABEL: parametrized_protocol.(file).SequenceWrapper@ +// CHECK-LABEL: parameterized_protocol.(file).SequenceWrapper@ // CHECK: Generic signature: struct SequenceWrapper, E> {} /// Parametrized protocol in associated type inheritance clause -// CHECK-LABEL: parametrized_protocol.(file).IntSequenceWrapperProtocol@ +// CHECK-LABEL: parameterized_protocol.(file).IntSequenceWrapperProtocol@ // CHECK: Requirement signature: protocol IntSequenceWrapperProtocol { associatedtype S : Sequence } -// CHECK-LABEL: parametrized_protocol.(file).SequenceWrapperProtocol@ +// CHECK-LABEL: parameterized_protocol.(file).SequenceWrapperProtocol@ // CHECK: Requirement signature: protocol SequenceWrapperProtocol { associatedtype S : Sequence @@ -60,24 +60,24 @@ protocol SequenceWrapperProtocol { /// Parametrized protocol in where clause of concrete type -// CHECK-LABEL: parametrized_protocol.(file).IntSequenceWrapper2@ +// CHECK-LABEL: parameterized_protocol.(file).IntSequenceWrapper2@ // CHECK: Generic signature: struct IntSequenceWrapper2 where S : Sequence {} -// CHECK-LABEL: parametrized_protocol.(file).SequenceWrapper2@ +// CHECK-LABEL: parameterized_protocol.(file).SequenceWrapper2@ // CHECK: Generic signature: struct SequenceWrapper2 where S : Sequence {} /// Parametrized protocol in where clause of associated type -// CHECK-LABEL: parametrized_protocol.(file).IntSequenceWrapperProtocol2@ +// CHECK-LABEL: parameterized_protocol.(file).IntSequenceWrapperProtocol2@ // CHECK: Requirement signature: protocol IntSequenceWrapperProtocol2 { associatedtype S where S : Sequence } -// CHECK-LABEL: parametrized_protocol.(file).SequenceWrapperProtocol2@ +// CHECK-LABEL: parameterized_protocol.(file).SequenceWrapperProtocol2@ // CHECK: Requirement signature: protocol SequenceWrapperProtocol2 { associatedtype S where S : Sequence @@ -111,19 +111,19 @@ struct OpaqueTypes { } -/// Extensions of parametrized protocol type +/// Extensions of parameterized protocol type // CHECK-LABEL: ExtensionDecl line={{[0-9]+}} base=Sequence // CHECK: Generic signature: extension Sequence { - // CHECK-LABEL: parametrized_protocol.(file).Sequence extension.doSomethingGeneric@ + // CHECK-LABEL: parameterized_protocol.(file).Sequence extension.doSomethingGeneric@ // CHECK: Generic signature: func doSomethingGeneric(_: E) {} } -/// Cannot use parametrized protocol as the type of a value +/// Cannot use parameterized protocol as the type of a value func takesSequenceOfInt1(_: Sequence) {} // expected-error@-1 {{protocol type with generic argument can only be used as a generic constraint}}