Skip to content

Commit 63b98d5

Browse files
authored
Merge pull request #41184 from slavapestov/fix-typo
Change spelling of "ParametrizedProtocolType" to "ParameterizedProtocolType"
2 parents 983cf2c + 0177f75 commit 63b98d5

37 files changed

+127
-129
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2780,8 +2780,8 @@ ERROR(inheritance_from_non_protocol_or_class,none,
27802780
"inheritance from non-protocol, non-class type %0", (Type))
27812781
ERROR(inheritance_from_non_protocol,none,
27822782
"inheritance from non-protocol type %0", (Type))
2783-
ERROR(inheritance_from_parametrized_protocol,none,
2784-
"cannot inherit from parametrized protocol type %0", (Type))
2783+
ERROR(inheritance_from_parameterized_protocol,none,
2784+
"cannot inherit from protocol type with generic argument %0", (Type))
27852785
ERROR(superclass_not_first,none,
27862786
"superclass %0 must appear first in the inheritance clause", (Type))
27872787
ERROR(superclass_not_open,none,
@@ -3723,7 +3723,7 @@ ERROR(not_a_generic_definition,none,
37233723
"cannot specialize a non-generic definition", ())
37243724
ERROR(not_a_generic_type,none,
37253725
"cannot specialize non-generic type %0", (Type))
3726-
ERROR(parametrized_protocol_not_supported,none,
3726+
ERROR(parameterized_protocol_not_supported,none,
37273727
"protocol type with generic argument can only be used as a generic constraint", ())
37283728
ERROR(protocol_does_not_have_primary_assoc_type,none,
37293729
"cannot specialize protocol type %0", (Type))

include/swift/AST/ExistentialLayout.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct ExistentialLayout {
4242

4343
ExistentialLayout(ProtocolType *type);
4444
ExistentialLayout(ProtocolCompositionType *type);
45-
ExistentialLayout(ParametrizedProtocolType *type);
45+
ExistentialLayout(ParameterizedProtocolType *type);
4646

4747
/// The explicit superclass constraint, if any.
4848
Type explicitSuperclass;
@@ -116,7 +116,7 @@ struct ExistentialLayout {
116116
ArrayRef<Type> protocols;
117117

118118
/// Zero or more primary associated type requirements from a
119-
/// ParametrizedProtocolType
119+
/// ParameterizedProtocolType
120120
ArrayRef<PrimaryAssociatedTypeRequirement> sameTypeRequirements;
121121
};
122122

include/swift/AST/TypeDifferenceVisitor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ class CanTypeDifferenceVisitor : public CanTypePairVisitor<Impl, bool> {
339339
type1->getMembers(), type2->getMembers());
340340
}
341341

342-
bool visitParametrizedProtocolType(CanParametrizedProtocolType type1,
343-
CanParametrizedProtocolType type2) {
342+
bool visitParameterizedProtocolType(CanParameterizedProtocolType type1,
343+
CanParameterizedProtocolType type2) {
344344
if (asImpl().visit(type1.getBaseType(), type2.getBaseType()))
345345
return true;
346346

include/swift/AST/TypeMatcher.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,20 +305,20 @@ class TypeMatcher {
305305
TRIVIAL_CASE(SILBoxType)
306306
TRIVIAL_CASE(ProtocolCompositionType)
307307

308-
bool visitParametrizedProtocolType(CanParametrizedProtocolType firstParametrizedProto,
309-
Type secondType,
310-
Type sugaredFirstType) {
311-
if (auto secondParametrizedProto = secondType->getAs<ParametrizedProtocolType>()) {
308+
bool visitParameterizedProtocolType(CanParameterizedProtocolType firstParametrizedProto,
309+
Type secondType,
310+
Type sugaredFirstType) {
311+
if (auto secondParametrizedProto = secondType->getAs<ParameterizedProtocolType>()) {
312312
if (!this->visit(firstParametrizedProto.getBaseType(),
313313
secondParametrizedProto->getBaseType(),
314-
sugaredFirstType->castTo<ParametrizedProtocolType>()
314+
sugaredFirstType->castTo<ParameterizedProtocolType>()
315315
->getBaseType())) {
316316
return false;
317317
}
318318

319319
return this->visit(firstParametrizedProto.getArgumentType(),
320320
secondParametrizedProto->getArgumentType(),
321-
sugaredFirstType->castTo<ParametrizedProtocolType>()
321+
sugaredFirstType->castTo<ParameterizedProtocolType>()
322322
->getArgumentType());
323323
}
324324

include/swift/AST/TypeNodes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ ARTIFICIAL_TYPE(SILBlockStorage, Type)
161161
ARTIFICIAL_TYPE(SILBox, Type)
162162
ARTIFICIAL_TYPE(SILToken, Type)
163163
TYPE(ProtocolComposition, Type)
164-
TYPE(ParametrizedProtocol, Type)
164+
TYPE(ParameterizedProtocol, Type)
165165
TYPE(Existential, Type)
166166
TYPE(LValue, Type)
167167
TYPE(InOut, Type)

include/swift/AST/Types.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5243,7 +5243,7 @@ class ProtocolCompositionType final : public TypeBase,
52435243
BEGIN_CAN_TYPE_WRAPPER(ProtocolCompositionType, Type)
52445244
END_CAN_TYPE_WRAPPER(ProtocolCompositionType, Type)
52455245

5246-
/// ParametrizedProtocolType - A type that constrains the primary associated
5246+
/// ParameterizedProtocolType - A type that constrains the primary associated
52475247
/// type of a protocol to an argument type.
52485248
///
52495249
/// Written like a bound generic type, eg Sequence<Int>.
@@ -5259,7 +5259,7 @@ END_CAN_TYPE_WRAPPER(ProtocolCompositionType, Type)
52595259
/// \code
52605260
/// T : Sequence where T.Element == Int.
52615261
/// \endcode
5262-
class ParametrizedProtocolType final : public TypeBase,
5262+
class ParameterizedProtocolType final : public TypeBase,
52635263
public llvm::FoldingSetNode {
52645264
friend struct ExistentialLayout;
52655265

@@ -5294,18 +5294,18 @@ class ParametrizedProtocolType final : public TypeBase,
52945294

52955295
// Implement isa/cast/dyncast/etc.
52965296
static bool classof(const TypeBase *T) {
5297-
return T->getKind() == TypeKind::ParametrizedProtocol;
5297+
return T->getKind() == TypeKind::ParameterizedProtocol;
52985298
}
52995299

53005300
private:
5301-
ParametrizedProtocolType(const ASTContext *ctx,
5302-
ProtocolType *base, Type arg,
5303-
RecursiveTypeProperties properties);
5301+
ParameterizedProtocolType(const ASTContext *ctx,
5302+
ProtocolType *base, Type arg,
5303+
RecursiveTypeProperties properties);
53045304
};
5305-
BEGIN_CAN_TYPE_WRAPPER(ParametrizedProtocolType, Type)
5305+
BEGIN_CAN_TYPE_WRAPPER(ParameterizedProtocolType, Type)
53065306
PROXY_CAN_TYPE_SIMPLE_GETTER(getBaseType)
53075307
PROXY_CAN_TYPE_SIMPLE_GETTER(getArgumentType)
5308-
END_CAN_TYPE_WRAPPER(ParametrizedProtocolType, Type)
5308+
END_CAN_TYPE_WRAPPER(ParameterizedProtocolType, Type)
53095309

53105310
/// An existential type, spelled with \c any .
53115311
///
@@ -6365,7 +6365,8 @@ inline bool TypeBase::isConstraintType() const {
63656365

63666366
inline bool CanType::isConstraintTypeImpl(CanType type) {
63676367
return (isa<ProtocolType>(type) ||
6368-
isa<ProtocolCompositionType>(type));
6368+
isa<ProtocolCompositionType>(type) ||
6369+
isa<ParameterizedProtocolType>(type));
63696370
}
63706371

63716372
inline bool TypeBase::isExistentialType() {

include/swift/Basic/LangOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ namespace swift {
321321
/// keyword.
322322
bool EnableExplicitExistentialTypes = true;
323323

324-
/// Enable support for protocol types parametrized by primary
324+
/// Enable support for protocol types parameterized by primary
325325
/// associated type.
326-
bool EnableParametrizedProtocolTypes = false;
326+
bool EnableParameterizedProtocolTypes = false;
327327

328328
/// Enable experimental flow-sensitive concurrent captures.
329329
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,9 @@ def enable_explicit_existential_types :
517517
Flag<["-"], "enable-explicit-existential-types">,
518518
HelpText<"Enable experimental support for explicit existential types">;
519519

520-
def enable_parametrized_protocol_types :
521-
Flag<["-"], "enable-parametrized-protocol-types">,
522-
HelpText<"Enable experimental support for primary associated types and parametrized protocols">;
520+
def enable_parameterized_protocol_types :
521+
Flag<["-"], "enable-parameterized-protocol-types">,
522+
HelpText<"Enable experimental support for primary associated types and parameterized protocols">;
523523

524524
def enable_deserialization_recovery :
525525
Flag<["-"], "enable-deserialization-recovery">,

lib/AST/ASTContext.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ struct ASTContext::Implementation {
405405
llvm::FoldingSet<UnboundGenericType> UnboundGenericTypes;
406406
llvm::FoldingSet<BoundGenericType> BoundGenericTypes;
407407
llvm::FoldingSet<ProtocolCompositionType> ProtocolCompositionTypes;
408-
llvm::FoldingSet<ParametrizedProtocolType> ParametrizedProtocolTypes;
408+
llvm::FoldingSet<ParameterizedProtocolType> ParameterizedProtocolTypes;
409409
llvm::FoldingSet<LayoutConstraintInfo> LayoutConstraints;
410410
llvm::DenseMap<std::pair<OpaqueTypeDecl *, SubstitutionMap>,
411411
GenericEnvironment *> OpaqueArchetypeEnvironments;
@@ -3404,9 +3404,9 @@ ProtocolCompositionType::build(const ASTContext &C, ArrayRef<Type> Members,
34043404
return compTy;
34053405
}
34063406

3407-
Type ParametrizedProtocolType::get(const ASTContext &C,
3408-
ProtocolType *baseTy,
3409-
Type argTy) {
3407+
Type ParameterizedProtocolType::get(const ASTContext &C,
3408+
ProtocolType *baseTy,
3409+
Type argTy) {
34103410
bool isCanonical = baseTy->isCanonical();
34113411
RecursiveTypeProperties properties = baseTy->getRecursiveProperties();
34123412
properties |= argTy->getRecursiveProperties();
@@ -3416,16 +3416,16 @@ Type ParametrizedProtocolType::get(const ASTContext &C,
34163416

34173417
void *InsertPos = nullptr;
34183418
llvm::FoldingSetNodeID ID;
3419-
ParametrizedProtocolType::Profile(ID, baseTy, argTy);
3419+
ParameterizedProtocolType::Profile(ID, baseTy, argTy);
34203420

34213421
if (auto paramTy
3422-
= C.getImpl().getArena(arena).ParametrizedProtocolTypes
3422+
= C.getImpl().getArena(arena).ParameterizedProtocolTypes
34233423
.FindNodeOrInsertPos(ID, InsertPos))
34243424
return paramTy;
34253425

3426-
auto paramTy = new (C, arena) ParametrizedProtocolType(
3426+
auto paramTy = new (C, arena) ParameterizedProtocolType(
34273427
isCanonical ? &C : nullptr, baseTy, argTy, properties);
3428-
C.getImpl().getArena(arena).ParametrizedProtocolTypes.InsertNode(
3428+
C.getImpl().getArena(arena).ParameterizedProtocolTypes.InsertNode(
34293429
paramTy, InsertPos);
34303430
return paramTy;
34313431
}

lib/AST/ASTDumper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,9 +3942,9 @@ namespace {
39423942
PrintWithColorRAII(OS, ParenthesisColor) << ')';
39433943
}
39443944

3945-
void visitParametrizedProtocolType(ParametrizedProtocolType *T,
3946-
StringRef label) {
3947-
printCommon(label, "parametrized_protocol_type");
3945+
void visitParameterizedProtocolType(ParameterizedProtocolType *T,
3946+
StringRef label) {
3947+
printCommon(label, "parameterized_protocol_type");
39483948
printRec("base", T->getBaseType());
39493949
printRec("arg", T->getArgumentType());
39503950
PrintWithColorRAII(OS, ParenthesisColor) << ')';

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
12661266
return appendExistentialLayout(layout, sig, forDecl);
12671267
}
12681268

1269-
case TypeKind::ParametrizedProtocol: {
1269+
case TypeKind::ParameterizedProtocol: {
12701270
llvm::errs() << "Not implemented\n";
12711271
abort();
12721272
}

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5921,7 +5921,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
59215921
}
59225922
}
59235923

5924-
void visitParametrizedProtocolType(ParametrizedProtocolType *T) {
5924+
void visitParameterizedProtocolType(ParameterizedProtocolType *T) {
59255925
visit(T->getBaseType());
59265926
Printer << "<";
59275927
visit(T->getArgumentType());

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4500,9 +4500,7 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement(
45004500
}
45014501

45024502
// Check whether we have a reasonable constraint type at all.
4503-
if (!constraintType->is<ProtocolType>() &&
4504-
!constraintType->is<ProtocolCompositionType>() &&
4505-
!constraintType->is<ParametrizedProtocolType>() &&
4503+
if (!constraintType->isConstraintType() &&
45064504
!constraintType->getClassOrBoundGenericClass()) {
45074505
if (source.getLoc().isValid() && !constraintType->hasError()) {
45084506
Impl->HadAnyError = true;
@@ -4516,7 +4514,7 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement(
45164514
}
45174515

45184516
// Parametrized protocol requirements.
4519-
if (auto *paramProtoType = constraintType->getAs<ParametrizedProtocolType>()) {
4517+
if (auto *paramProtoType = constraintType->getAs<ParameterizedProtocolType>()) {
45204518
bool anyErrors = false;
45214519

45224520
auto *protoDecl = paramProtoType->getBaseType()->getDecl();

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static void desugarConformanceRequirement(Type subjectType, Type constraintType,
133133
return;
134134
}
135135

136-
if (auto *paramType = constraintType->getAs<ParametrizedProtocolType>()) {
136+
if (auto *paramType = constraintType->getAs<ParameterizedProtocolType>()) {
137137
auto *protoDecl = paramType->getBaseType()->getDecl();
138138

139139
desugarConformanceRequirement(subjectType, paramType->getBaseType(),
@@ -212,9 +212,7 @@ static void realizeTypeRequirement(Type subjectType, Type constraintType,
212212
SmallVectorImpl<StructuralRequirement> &result) {
213213
SmallVector<Requirement, 2> reqs;
214214

215-
if (constraintType->is<ProtocolType>() ||
216-
constraintType->is<ProtocolCompositionType>() ||
217-
constraintType->is<ParametrizedProtocolType>()) {
215+
if (constraintType->isConstraintType()) {
218216
// Handle conformance requirements.
219217
desugarConformanceRequirement(subjectType, constraintType, reqs);
220218
} else if (constraintType->getClassOrBoundGenericClass()) {

lib/AST/Type.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ bool CanType::isReferenceTypeImpl(CanType type, const GenericSignatureImpl *sig,
191191
return cast<ProtocolType>(type)->requiresClass();
192192
case TypeKind::ProtocolComposition:
193193
return cast<ProtocolCompositionType>(type)->requiresClass();
194-
case TypeKind::ParametrizedProtocol:
195-
return cast<ParametrizedProtocolType>(type)->getBaseType()->requiresClass();
194+
case TypeKind::ParameterizedProtocol:
195+
return cast<ParameterizedProtocolType>(type)->getBaseType()->requiresClass();
196196
case TypeKind::Existential:
197197
return isReferenceTypeImpl(cast<ExistentialType>(type).getConstraintType(),
198198
sig, functionsCount);
@@ -295,7 +295,7 @@ ExistentialLayout::ExistentialLayout(ProtocolCompositionType *type) {
295295
protocols = { members.data(), members.size() };
296296
}
297297

298-
ExistentialLayout::ExistentialLayout(ParametrizedProtocolType *type) {
298+
ExistentialLayout::ExistentialLayout(ParameterizedProtocolType *type) {
299299
assert(type->isCanonical());
300300

301301
*this = ExistentialLayout(type->getBaseType());
@@ -319,7 +319,7 @@ ExistentialLayout CanType::getExistentialLayout() {
319319
if (auto proto = dyn_cast<ProtocolType>(*this))
320320
return ExistentialLayout(proto);
321321

322-
if (auto param = dyn_cast<ParametrizedProtocolType>(*this))
322+
if (auto param = dyn_cast<ParameterizedProtocolType>(*this))
323323
return ExistentialLayout(param);
324324

325325
auto comp = cast<ProtocolCompositionType>(*this);
@@ -1553,12 +1553,12 @@ CanType TypeBase::computeCanonicalType() {
15531553
Result = Composition.getPointer();
15541554
break;
15551555
}
1556-
case TypeKind::ParametrizedProtocol: {
1557-
auto *PPT = cast<ParametrizedProtocolType>(this);
1556+
case TypeKind::ParameterizedProtocol: {
1557+
auto *PPT = cast<ParameterizedProtocolType>(this);
15581558
auto Base = cast<ProtocolType>(PPT->getBaseType()->getCanonicalType());
15591559
auto Arg = PPT->getArgumentType()->getCanonicalType();
15601560
auto &C = Base->getASTContext();
1561-
Result = ParametrizedProtocolType::get(C, Base, Arg).getPointer();
1561+
Result = ParameterizedProtocolType::get(C, Base, Arg).getPointer();
15621562
break;
15631563
}
15641564
case TypeKind::Existential: {
@@ -3873,20 +3873,20 @@ void ProtocolCompositionType::Profile(llvm::FoldingSetNodeID &ID,
38733873
ID.AddPointer(T.getPointer());
38743874
}
38753875

3876-
ParametrizedProtocolType::ParametrizedProtocolType(
3876+
ParameterizedProtocolType::ParameterizedProtocolType(
38773877
const ASTContext *ctx,
38783878
ProtocolType *base, Type arg,
38793879
RecursiveTypeProperties properties)
3880-
: TypeBase(TypeKind::ParametrizedProtocol, /*Context=*/ctx, properties),
3880+
: TypeBase(TypeKind::ParameterizedProtocol, /*Context=*/ctx, properties),
38813881
Base(base), AssocType(base->getDecl()->getPrimaryAssociatedType()),
38823882
Arg(arg) {
38833883
assert(AssocType != nullptr &&
38843884
"Protocol doesn't have a primary associated type");
38853885
}
38863886

3887-
void ParametrizedProtocolType::Profile(llvm::FoldingSetNodeID &ID,
3888-
ProtocolType *baseTy,
3889-
Type argTy) {
3887+
void ParameterizedProtocolType::Profile(llvm::FoldingSetNodeID &ID,
3888+
ProtocolType *baseTy,
3889+
Type argTy) {
38903890
ID.AddPointer(baseTy);
38913891
ID.AddPointer(argTy.getPointer());
38923892
}
@@ -5676,8 +5676,8 @@ case TypeKind::Id:
56765676
pc->hasExplicitAnyObject());
56775677
}
56785678

5679-
case TypeKind::ParametrizedProtocol: {
5680-
auto *ppt = cast<ParametrizedProtocolType>(base);
5679+
case TypeKind::ParameterizedProtocol: {
5680+
auto *ppt = cast<ParameterizedProtocolType>(base);
56815681
Type base = ppt->getBaseType();
56825682
Type arg = ppt->getArgumentType();
56835683

@@ -5700,7 +5700,7 @@ case TypeKind::Id:
57005700
if (!anyChanged)
57015701
return *this;
57025702

5703-
return ParametrizedProtocolType::get(
5703+
return ParameterizedProtocolType::get(
57045704
Ptr->getASTContext(),
57055705
substBase->castTo<ProtocolType>(),
57065706
substArg);
@@ -5863,8 +5863,8 @@ ReferenceCounting TypeBase::getReferenceCounting() {
58635863
return ReferenceCounting::Unknown;
58645864
}
58655865

5866-
case TypeKind::ParametrizedProtocol: {
5867-
return cast<ParametrizedProtocolType>(this)
5866+
case TypeKind::ParameterizedProtocol: {
5867+
return cast<ParameterizedProtocolType>(this)
58685868
->getBaseType()
58695869
->getReferenceCounting();
58705870
}

lib/AST/TypeWalker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class Traversal : public TypeVisitor<Traversal, bool>
174174
return false;
175175
}
176176

177-
bool visitParametrizedProtocolType(ParametrizedProtocolType *ty) {
177+
bool visitParameterizedProtocolType(ParameterizedProtocolType *ty) {
178178
if (doIt(ty->getBaseType()))
179179
return true;
180180

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
451451
Opts.EnableExplicitExistentialTypes |=
452452
Args.hasArg(OPT_enable_explicit_existential_types);
453453

454-
Opts.EnableParametrizedProtocolTypes |=
455-
Args.hasArg(OPT_enable_parametrized_protocol_types);
454+
Opts.EnableParameterizedProtocolTypes |=
455+
Args.hasArg(OPT_enable_parameterized_protocol_types);
456456

457457
Opts.EnableExperimentalDistributed |=
458458
Args.hasArg(OPT_enable_experimental_distributed);

0 commit comments

Comments
 (0)