Skip to content

Commit df03e94

Browse files
Merge pull request #4549 from swiftwasm/release/5.7
[pull] swiftwasm-release/5.7 from release/5.7
2 parents 753dfc9 + db4493a commit df03e94

File tree

120 files changed

+1752
-938
lines changed

Some content is hidden

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

120 files changed

+1752
-938
lines changed

include/swift/AST/ASTContext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,10 @@ class ASTContext final {
868868
/// swift_isUniquelyReferenced functions.
869869
AvailabilityContext getObjCIsUniquelyReferencedAvailability();
870870

871+
/// Get the runtime availability of metadata manipulation runtime functions
872+
/// for extended existential types.
873+
AvailabilityContext getParameterizedExistentialRuntimeAvailability();
874+
871875
/// Get the runtime availability of features introduced in the Swift 5.2
872876
/// compiler for the target platform.
873877
AvailabilityContext getSwift52Availability();

include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ ERROR(forbidden_extended_escaping_string,none,
9494
ERROR(regex_literal_parsing_error,none,
9595
"%0", (StringRef))
9696

97-
ERROR(prefix_slash_not_allowed,none,
98-
"prefix operator may not contain '/'", ())
99-
10097
//------------------------------------------------------------------------------
10198
// MARK: Lexer diagnostics
10299
//------------------------------------------------------------------------------

include/swift/AST/DiagnosticsSema.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5609,6 +5609,11 @@ ERROR(availability_concurrency_only_version_newer, none,
56095609
"concurrency is only available in %0 %1 or newer",
56105610
(StringRef, llvm::VersionTuple))
56115611

5612+
ERROR(availability_parameterized_protocol_only_version_newer, none,
5613+
"runtime support for parameterized protocol types is only available in "
5614+
"%0 %1 or newer",
5615+
(StringRef, llvm::VersionTuple))
5616+
56125617
NOTE(availability_guard_with_version_check, none,
56135618
"add 'if #available' version check", ())
56145619

include/swift/AST/TypeReprNodes.def

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
#define ABSTRACT_TYPEREPR(Id, Parent)
3232
#endif
3333

34+
/// SPECIFIER_TYPEREPR(Id, Parent)
35+
///
36+
/// A specific TypeRepr that's a child of SpecifierTypeRepr.
37+
#ifndef SPECIFIER_TYPEREPR
38+
#define SPECIFIER_TYPEREPR TYPEREPR
39+
#endif
40+
3441
#ifndef LAST_TYPEREPR
3542
#define LAST_TYPEREPR(Id)
3643
#endif
@@ -58,15 +65,16 @@ TYPEREPR(NamedOpaqueReturn, TypeRepr)
5865
TYPEREPR(Existential, TypeRepr)
5966
TYPEREPR(Placeholder, TypeRepr)
6067
ABSTRACT_TYPEREPR(Specifier, TypeRepr)
61-
TYPEREPR(InOut, SpecifierTypeRepr)
62-
TYPEREPR(Shared, SpecifierTypeRepr)
63-
TYPEREPR(Owned, SpecifierTypeRepr)
64-
TYPEREPR(Isolated, SpecifierTypeRepr)
65-
TYPEREPR(CompileTimeConst, SpecifierTypeRepr)
68+
SPECIFIER_TYPEREPR(InOut, SpecifierTypeRepr)
69+
SPECIFIER_TYPEREPR(Shared, SpecifierTypeRepr)
70+
SPECIFIER_TYPEREPR(Owned, SpecifierTypeRepr)
71+
SPECIFIER_TYPEREPR(Isolated, SpecifierTypeRepr)
72+
SPECIFIER_TYPEREPR(CompileTimeConst, SpecifierTypeRepr)
6673
TYPEREPR(Fixed, TypeRepr)
6774
TYPEREPR(SILBox, TypeRepr)
6875
LAST_TYPEREPR(SILBox)
6976

77+
#undef SPECIFIER_TYPEREPR
7078
#undef ABSTRACT_TYPEREPR
7179
#undef TYPEREPR
7280
#undef LAST_TYPEREPR

include/swift/AST/Types.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ class RecursiveTypeProperties {
163163
/// type sequence
164164
HasTypeSequence = 0x1000,
165165

166-
Last_Property = HasTypeSequence
166+
/// This type contains a parameterized existential type \c any P<T>.
167+
HasParameterizedExistential = 0x2000,
168+
169+
Last_Property = HasParameterizedExistential
167170
};
168171
enum { BitWidth = countBitsUsed(Property::Last_Property) };
169172

@@ -223,6 +226,12 @@ class RecursiveTypeProperties {
223226

224227
bool hasTypeSequence() const { return Bits & HasTypeSequence; }
225228

229+
/// Does a type with these properties structurally contain a
230+
/// parameterized existential type?
231+
bool hasParameterizedExistential() const {
232+
return Bits & HasParameterizedExistential;
233+
}
234+
226235
/// Returns the set of properties present in either set.
227236
friend RecursiveTypeProperties operator|(Property lhs, Property rhs) {
228237
return RecursiveTypeProperties(unsigned(lhs) | unsigned(rhs));
@@ -626,6 +635,11 @@ class alignas(1 << TypeAlignInBits) TypeBase
626635
return getRecursiveProperties().hasTypeSequence();
627636
}
628637

638+
/// Determine whether the type involves a parameterized existential type.
639+
bool hasParameterizedExistential() const {
640+
return getRecursiveProperties().hasParameterizedExistential();
641+
}
642+
629643
/// Determine whether the type involves the given opened existential
630644
/// archetype.
631645
bool hasOpenedExistentialWithRoot(const OpenedArchetypeType *root) const;

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ namespace swift {
569569
/// rewrite system.
570570
bool EnableRequirementMachineOpaqueArchetypes = false;
571571

572+
/// Enable warnings for redundant requirements in generic signatures.
573+
bool WarnRedundantRequirements = false;
574+
572575
/// Enables dumping type witness systems from associated type inference.
573576
bool DumpTypeWitnessSystems = false;
574577

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ def disable_requirement_machine_reuse : Flag<["-"], "disable-requirement-machine
378378
def enable_requirement_machine_opaque_archetypes : Flag<["-"], "enable-requirement-machine-opaque-archetypes">,
379379
HelpText<"Enable more correct opaque archetype support, which is off by default because it might fail to produce a convergent rewrite system">;
380380

381+
def warn_redundant_requirements : Flag<["-"], "warn-redundant-requirements">,
382+
HelpText<"Emit warnings for redundant requirements in generic signatures">;
383+
381384
def dump_type_witness_systems : Flag<["-"], "dump-type-witness-systems">,
382385
HelpText<"Enables dumping type witness systems from associated type inference">;
383386

include/swift/Parse/Parser.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,10 +1762,7 @@ class Parser {
17621762
/// Try re-lex a '/' operator character as a regex literal. This should be
17631763
/// called when parsing in an expression position to ensure a regex literal is
17641764
/// correctly parsed.
1765-
///
1766-
/// If \p mustBeRegex is set to true, a regex literal will always be lexed if
1767-
/// enabled. Otherwise, it will not be lexed if it may be ambiguous.
1768-
void tryLexRegexLiteral(bool mustBeRegex);
1765+
void tryLexRegexLiteral(bool forUnappliedOperator);
17691766

17701767
void validateCollectionElement(ParserResult<Expr> element);
17711768

lib/AST/ASTContext.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3440,6 +3440,8 @@ ExistentialMetatypeType::get(Type T, Optional<MetatypeRepresentation> repr,
34403440
T = existential->getConstraintType();
34413441

34423442
auto properties = T->getRecursiveProperties();
3443+
if (T->is<ParameterizedProtocolType>())
3444+
properties |= RecursiveTypeProperties::HasParameterizedExistential;
34433445
auto arena = getArena(properties);
34443446

34453447
unsigned reprKey;
@@ -3535,7 +3537,7 @@ isAnyFunctionTypeCanonical(ArrayRef<AnyFunctionType::Param> params,
35353537
static RecursiveTypeProperties
35363538
getGenericFunctionRecursiveProperties(ArrayRef<AnyFunctionType::Param> params,
35373539
Type result) {
3538-
static_assert(RecursiveTypeProperties::BitWidth == 13,
3540+
static_assert(RecursiveTypeProperties::BitWidth == 14,
35393541
"revisit this if you add new recursive type properties");
35403542
RecursiveTypeProperties properties;
35413543

@@ -4124,7 +4126,7 @@ CanSILFunctionType SILFunctionType::get(
41244126
void *mem = ctx.Allocate(bytes, alignof(SILFunctionType));
41254127

41264128
RecursiveTypeProperties properties;
4127-
static_assert(RecursiveTypeProperties::BitWidth == 13,
4129+
static_assert(RecursiveTypeProperties::BitWidth == 14,
41284130
"revisit this if you add new recursive type properties");
41294131
for (auto &param : params)
41304132
properties |= param.getInterfaceType()->getRecursiveProperties();
@@ -4242,6 +4244,8 @@ Type ExistentialType::get(Type constraint, bool forceExistential) {
42424244
assert(constraint->isConstraintType());
42434245

42444246
auto properties = constraint->getRecursiveProperties();
4247+
if (constraint->is<ParameterizedProtocolType>())
4248+
properties |= RecursiveTypeProperties::HasParameterizedExistential;
42454249
auto arena = getArena(properties);
42464250

42474251
auto &entry = C.getImpl().getArena(arena).ExistentialTypes[constraint];

lib/AST/Availability.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ AvailabilityContext ASTContext::getObjCIsUniquelyReferencedAvailability() {
394394
return getSwift56Availability();
395395
}
396396

397+
AvailabilityContext
398+
ASTContext::getParameterizedExistentialRuntimeAvailability() {
399+
return getSwift57Availability();
400+
}
401+
397402
AvailabilityContext ASTContext::getSwift52Availability() {
398403
auto target = LangOpts.Target;
399404

0 commit comments

Comments
 (0)