Skip to content

Commit 36ebf9b

Browse files
authored
Merge pull request #4214 from swiftwasm/main
2 parents 15b30e3 + 8fc787e commit 36ebf9b

File tree

94 files changed

+879
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+879
-317
lines changed

include/swift/AST/Decl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,8 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
861861
void print(raw_ostream &OS) const;
862862
void print(raw_ostream &OS, const PrintOptions &Opts) const;
863863

864+
void printInherited(ASTPrinter &Printer, const PrintOptions &Options) const;
865+
864866
/// Pretty-print the given declaration.
865867
///
866868
/// \param Printer ASTPrinter object.

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/PrintOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ struct PrintOptions {
486486
/// Whether to print inheritance lists for types.
487487
bool PrintInherited = true;
488488

489+
/// Whether to print a space before the `:` of an inheritance list in a type
490+
/// decl.
491+
bool PrintSpaceBeforeInheritance = true;
492+
489493
/// Whether to print feature checks for compatibility with older Swift
490494
/// compilers that might parse the result.
491495
bool PrintCompatibilityFeatureChecks = false;

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/IDE/RefactoringKinds.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ CURSOR_REFACTORING(MemberwiseInitLocalRefactoring, "Generate Memberwise Initiali
5454

5555
CURSOR_REFACTORING(AddEquatableConformance, "Add Equatable Conformance", add.equatable.conformance)
5656

57+
CURSOR_REFACTORING(AddExplicitCodableImplementation, "Add Explicit Codable Implementation", add.explicit-codable-implementation)
58+
5759
CURSOR_REFACTORING(ConvertCallToAsyncAlternative, "Convert Call to Async Alternative", convert.call-to-async)
5860

5961
CURSOR_REFACTORING(ConvertToAsync, "Convert Function to Async", convert.func-to-async)

0 commit comments

Comments
 (0)