Skip to content

Commit fd8ec39

Browse files
authored
Merge branch 'main' into wip-main-remove-task-current
2 parents e0eb940 + c15dde4 commit fd8ec39

File tree

105 files changed

+1159
-750
lines changed

Some content is hidden

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

105 files changed

+1159
-750
lines changed

cmake/modules/DarwinSDKs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ endif()
1313
set(SUPPORTED_TVOS_ARCHS "arm64")
1414
set(SUPPORTED_TVOS_SIMULATOR_ARCHS "x86_64;arm64")
1515
set(SUPPORTED_WATCHOS_ARCHS "armv7k;arm64_32")
16-
set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;arm64")
16+
set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;x86_64;arm64")
1717
set(SUPPORTED_OSX_ARCHS "x86_64;arm64;arm64e")
1818

1919
is_sdk_requested(OSX swift_build_osx)

include/swift/ABI/Metadata.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4897,6 +4897,9 @@ struct DynamicReplacementKey {
48974897
uint16_t getExtraDiscriminator() const {
48984898
return flags & 0x0000FFFF;
48994899
}
4900+
bool isAsync() const {
4901+
return ((flags >> 16 ) & 0x1);
4902+
}
49004903
};
49014904

49024905
/// A record describing a dynamic function replacement.

include/swift/AST/DiagnosticsSema.def

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4351,8 +4351,8 @@ NOTE(objc_ambiguous_async_convention_candidate,none,
43514351
ERROR(async_objc_dynamic_self,none,
43524352
"asynchronous method returning 'Self' cannot be '@objc'", ())
43534353

4354-
ERROR(actor_with_nonactor_superclass,none,
4355-
"actor cannot inherit from non-actor class %0", (DeclName))
4354+
ERROR(actor_inheritance,none,
4355+
"actor types do not support inheritance", ())
43564356

43574357
ERROR(actor_isolated_non_self_reference,none,
43584358
"actor-isolated %0 %1 can only be %select{referenced|mutated|used 'inout'}3 "
@@ -4426,6 +4426,9 @@ NOTE(actor_isolated_sync_func,none,
44264426
NOTE(actor_mutable_state,none,
44274427
"mutation of this %0 is only permitted within the actor",
44284428
(DescriptiveDeclKind))
4429+
NOTE(actor_isolated_let,none,
4430+
"use `nonisolated` to allow synchronous access to 'let' from outside "
4431+
"the actor", ())
44294432
WARNING(shared_mutable_state_access,none,
44304433
"reference to %0 %1 is not concurrency-safe because it involves "
44314434
"shared mutable state", (DescriptiveDeclKind, DeclName))
@@ -4458,13 +4461,12 @@ WARNING(non_concurrent_property_type,none,
44584461
WARNING(non_concurrent_keypath_capture,none,
44594462
"cannot form key path that captures non-sendable type %0",
44604463
(Type))
4461-
WARNING(non_concurrent_keypath_access,none,
4462-
"cannot form key path that accesses non-sendable type %0",
4463-
(Type))
44644464
ERROR(non_concurrent_type_member,none,
44654465
"%select{stored property %1|associated value %1}0 of "
44664466
"'Sendable'-conforming %2 %3 has non-sendable type %4",
44674467
(bool, DeclName, DescriptiveDeclKind, DeclName, Type))
4468+
ERROR(non_sendable_nonisolated_let,none,
4469+
"non-isolated let property %0 has non-Sendable type %1", (DeclName, Type))
44684470
ERROR(concurrent_value_class_mutable_property,none,
44694471
"stored property %0 of 'Sendable'-conforming %1 %2 is mutable",
44704472
(DeclName, DescriptiveDeclKind, DeclName))
@@ -4480,21 +4482,13 @@ ERROR(concurrent_value_inherit,none,
44804482
"%select{| other than 'NSObject'}0",
44814483
(bool, DeclName))
44824484

4483-
ERROR(actorindependent_let,none,
4484-
"'@actorIndependent' is meaningless on 'let' declarations because "
4485-
"they are immutable",
4486-
())
44874485
ERROR(actorindependent_mutable_storage,none,
44884486
"'@actorIndependent' can not be applied to stored properties",
44894487
())
44904488
ERROR(actorindependent_local_var,none,
44914489
"'@actorIndependent' can not be applied to local variables",
44924490
())
44934491

4494-
ERROR(nonisolated_let,none,
4495-
"'nonisolated' is meaningless on 'let' declarations because "
4496-
"they are immutable",
4497-
())
44984492
ERROR(nonisolated_mutable_storage,none,
44994493
"nonisolated' can not be applied to stored properties",
45004494
())
@@ -5678,8 +5672,8 @@ ERROR(wrapped_value_mismatch, none,
56785672
"property type %0 does not match 'wrappedValue' type %1",
56795673
(Type, Type))
56805674
ERROR(composed_property_wrapper_mismatch, none,
5681-
"composed wrapper type %0 does not match former 'wrappedValue' type %1",
5682-
(Type, Type))
5675+
"composed wrapper type %0 does not match type of '%1.wrappedValue', which is %2",
5676+
(Type, StringRef, Type))
56835677

56845678
ERROR(property_wrapper_type_access,none,
56855679
"%select{%select{variable|constant}0|property}1 "

include/swift/Basic/Features.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ LANGUAGE_FEATURE(RethrowsProtocol, 0, "@rethrows protocol", true)
4343
LANGUAGE_FEATURE(GlobalActors, 0, "Global actors", langOpts.EnableExperimentalConcurrency)
4444
LANGUAGE_FEATURE(BuiltinJob, 0, "Builtin.Job type", true)
4545
LANGUAGE_FEATURE(Sendable, 0, "Sendable and @Sendable", true)
46+
LANGUAGE_FEATURE(BuiltinExecutor, 0, "Executor builtins", true)
4647
LANGUAGE_FEATURE(BuiltinContinuation, 0, "Continuation builtins", true)
4748
LANGUAGE_FEATURE(BuiltinTaskGroup, 0, "TaskGroup builtins", true)
49+
LANGUAGE_FEATURE(InheritActorContext, 0, "@_inheritActorContext attribute", true)
4850

4951
#undef LANGUAGE_FEATURE

include/swift/Basic/FileTypes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ TYPE("index-unit-output-path", IndexUnitOutputPath, "", "")
8383
TYPE("yaml-opt-record", YAMLOptRecord, "opt.yaml", "")
8484
TYPE("bitstream-opt-record",BitstreamOptRecord, "opt.bitstream", "")
8585

86-
TYPE("symbol-graph-output-path", SymbolGraphOutputPath, "", "")
87-
8886
// Overlay files declare wrapper modules, called "separately-imported overlays",
8987
// that should be automatically imported when a particular module is imported.
9088
// Cross-import directories conditionalize overlay files so they only take

include/swift/Basic/SupplementaryOutputPaths.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ struct SupplementaryOutputPaths {
152152

153153
/// The path to which we should emit module summary file.
154154
std::string ModuleSummaryOutputPath;
155-
156-
/// The directory to which we should emit symbol graphs for the current module.
157-
std::string SymbolGraphOutputDir;
158155

159156
SupplementaryOutputPaths() = default;
160157
SupplementaryOutputPaths(const SupplementaryOutputPaths &) = default;
@@ -189,8 +186,6 @@ struct SupplementaryOutputPaths {
189186
fn(LdAddCFilePath);
190187
if (!ModuleSummaryOutputPath.empty())
191188
fn(ModuleSummaryOutputPath);
192-
if (!SymbolGraphOutputDir.empty())
193-
fn(SymbolGraphOutputDir);
194189
}
195190

196191
bool empty() const {
@@ -199,8 +194,7 @@ struct SupplementaryOutputPaths {
199194
ReferenceDependenciesFilePath.empty() &&
200195
SerializedDiagnosticsPath.empty() && LoadedModuleTracePath.empty() &&
201196
TBDPath.empty() && ModuleInterfaceOutputPath.empty() &&
202-
ModuleSourceInfoOutputPath.empty() && LdAddCFilePath.empty() &&
203-
SymbolGraphOutputDir.empty();
197+
ModuleSourceInfoOutputPath.empty() && LdAddCFilePath.empty();
204198
}
205199
};
206200
} // namespace swift

include/swift/Driver/Driver.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,6 @@ class Driver {
416416
const TypeToPathMap *OutputMap,
417417
StringRef workingDirectory,
418418
CommandOutput *Output) const;
419-
420-
void chooseSymbolGraphOutputPath(Compilation &C,
421-
const TypeToPathMap *OutputMap,
422-
StringRef workingDirectory,
423-
CommandOutput *Output) const;
424419

425420
void chooseLoadedModuleTracePath(Compilation &C,
426421
StringRef workingDirectory,

include/swift/Runtime/BackDeployment.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

include/swift/Runtime/Bincompat.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,18 @@ namespace bincompat {
2222

2323
/// Whether protocol conformance iteration should be reversed, to prefer
2424
/// conformances from images that are later in the list over earlier ones.
25+
/// Default is false starting with Swift 5.4.
2526
bool workaroundProtocolConformanceReverseIteration();
2627

28+
/// Whether we should crash when we encounter a non-nullable Obj-C
29+
/// reference with a null value as the source of a cast.
30+
/// Default is true starting with Swift 5.4.
31+
bool unexpectedObjCNullWhileCastingIsFatal();
32+
33+
/// Whether we should use the legacy semantics for casting nil optionals
34+
/// to nested optionals
35+
bool useLegacyOptionalNilInjection();
36+
2737
} // namespace bincompat
2838

2939
} // namespace runtime

include/swift/Runtime/Config.h

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,34 +100,21 @@
100100
/// from ObjC classes?
101101
#ifndef SWIFT_CLASS_IS_SWIFT_MASK
102102

103-
// Non-Apple platforms always use 1.
104-
# if !defined(__APPLE__)
105-
# define SWIFT_CLASS_IS_SWIFT_MASK 1ULL
106-
107-
// Builds for Swift-in-the-OS always use 2.
108-
# elif SWIFT_BNI_OS_BUILD
109-
# define SWIFT_CLASS_IS_SWIFT_MASK 2ULL
110-
111-
// Builds for Xcode always use 1.
112-
# elif SWIFT_BNI_XCODE_BUILD
113-
# define SWIFT_CLASS_IS_SWIFT_MASK 1ULL
114-
115103
// Compatibility hook libraries cannot rely on the "is swift" bit being either
116104
// value, since they must work with both OS and Xcode versions of the libraries.
117105
// Generate a reference to a nonexistent symbol so that we get obvious linker
118106
// errors if we try.
119-
# elif SWIFT_COMPATIBILITY_LIBRARY
107+
# if SWIFT_COMPATIBILITY_LIBRARY
120108
extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTLY__;
121109
# define SWIFT_CLASS_IS_SWIFT_MASK __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTLY__
122110

123-
// Other builds (such as local builds on developers' computers)
124-
// dynamically choose the bit at runtime based on the current OS
125-
// version.
111+
// Apple platforms always use 2
112+
# elif defined(__APPLE__)
113+
# define SWIFT_CLASS_IS_SWIFT_MASK 2ULL
114+
115+
// Non-Apple platforms always use 1.
126116
# else
127-
# define SWIFT_CLASS_IS_SWIFT_MASK _swift_classIsSwiftMask
128-
# define SWIFT_CLASS_IS_SWIFT_MASK_GLOBAL_VARIABLE 1
129-
# define SWIFT_BUILD_HAS_BACK_DEPLOYMENT 1
130-
# include "BackDeployment.h"
117+
# define SWIFT_CLASS_IS_SWIFT_MASK 1ULL
131118

132119
# endif
133120
#endif

include/swift/SIL/SILFunction.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,19 +1020,12 @@ class SILFunction
10201020

10211021
/// Transfer all blocks of \p F into this function, at the begin of the block
10221022
/// list.
1023-
void moveAllBlocksFromOtherFunction(SILFunction *F) {
1024-
BlockList.splice(begin(), F->BlockList);
1025-
}
1023+
void moveAllBlocksFromOtherFunction(SILFunction *F);
10261024

10271025
/// Transfer \p blockInOtherFunction of another function into this function,
10281026
/// before \p insertPointInThisFunction.
10291027
void moveBlockFromOtherFunction(SILBasicBlock *blockInOtherFunction,
1030-
iterator insertPointInThisFunction) {
1031-
SILFunction *otherFunc = blockInOtherFunction->getParent();
1032-
assert(otherFunc != this);
1033-
BlockList.splice(insertPointInThisFunction, otherFunc->BlockList,
1034-
blockInOtherFunction);
1035-
}
1028+
iterator insertPointInThisFunction);
10361029

10371030
/// Move block \p BB to immediately before the iterator \p IP.
10381031
///

include/swift/SIL/SILModule.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,13 @@ class SILModule {
304304
/// The value is either a SingleValueInstrution or a PlaceholderValue, in case
305305
/// an opened-archetype definition is lookedup during parsing or deserializing
306306
/// SIL, where opened archetypes can be forward referenced.
307-
llvm::DenseMap<ArchetypeType*, SILValue> openedArchetypeDefs;
307+
///
308+
/// In theory we wouldn't need to have the SILFunction in the key, because
309+
/// opened archetypes _should_ be unique across the module. But currently
310+
/// in some rare cases SILGen re-uses the same opened archetype for multiple
311+
/// functions.
312+
using OpenedArchetypeKey = std::pair<ArchetypeType*, SILFunction*>;
313+
llvm::DenseMap<OpenedArchetypeKey, SILValue> openedArchetypeDefs;
308314

309315
/// The number of PlaceholderValues in openedArchetypeDefs.
310316
int numUnresolvedOpenedArchetypes = 0;
@@ -382,15 +388,18 @@ class SILModule {
382388
/// In case the opened archetype is not defined yet (e.g. during parsing or
383389
/// deserilization), a PlaceholderValue is returned. This should not be the
384390
/// case outside of parsing or deserialization.
385-
SILValue getOpenedArchetypeDef(CanArchetypeType archetype);
391+
SILValue getOpenedArchetypeDef(CanArchetypeType archetype,
392+
SILFunction *inFunction);
386393

387394
/// Returns the instruction which defines an opened archetype, e.g. an
388395
/// open_existential_addr.
389396
///
390397
/// In contrast to getOpenedArchetypeDef, it is required that all opened
391398
/// archetypes are resolved.
392-
SingleValueInstruction *getOpenedArchetypeInst(CanArchetypeType archetype) {
393-
return cast<SingleValueInstruction>(getOpenedArchetypeDef(archetype));
399+
SingleValueInstruction *getOpenedArchetypeInst(CanArchetypeType archetype,
400+
SILFunction *inFunction) {
401+
return cast<SingleValueInstruction>(getOpenedArchetypeDef(archetype,
402+
inFunction));
394403
}
395404

396405
/// Returns true if there are unresolved opened archetypes in the module.
@@ -401,6 +410,9 @@ class SILModule {
401410
/// Called by SILBuilder whenever a new instruction is created and inserted.
402411
void notifyAddedInstruction(SILInstruction *inst);
403412

413+
/// Called after an instruction is moved from one function to another.
414+
void notifyMovedInstruction(SILInstruction *inst, SILFunction *fromFunction);
415+
404416
/// Add a delete notification handler \p Handler to the module context.
405417
void registerDeleteNotificationHandler(DeleteNotificationHandler* Handler);
406418

include/swift/Sema/CSFix.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ enum class FixKind : uint8_t {
322322
/// even though result type of the reference doesn't conform
323323
/// to an expected protocol.
324324
AllowInvalidStaticMemberRefOnProtocolMetatype,
325+
326+
/// Allow the wrappedValue type of any property wrapper that is a
327+
/// part of a composed property wrapper to mismatch the type of
328+
/// another property wrapper that is a part of the same composed
329+
/// property wrapper.
330+
AllowWrappedValueMismatch,
325331
};
326332

327333
class ConstraintFix {
@@ -615,6 +621,20 @@ class TreatArrayLiteralAsDictionary final : public ContextualMismatch {
615621
ConstraintLocator *loc);
616622
};
617623

624+
class AllowWrappedValueMismatch : public ContextualMismatch {
625+
AllowWrappedValueMismatch(ConstraintSystem &cs, Type lhs, Type rhs,
626+
ConstraintLocator *locator)
627+
: ContextualMismatch(cs, FixKind::AllowWrappedValueMismatch, lhs, rhs, locator) {}
628+
629+
public:
630+
std::string getName() const override { return "fix wrapped value type mismatch"; }
631+
632+
bool diagnose(const Solution &solution, bool asNote = false) const override;
633+
634+
static AllowWrappedValueMismatch *create(ConstraintSystem &cs, Type lhs, Type rhs,
635+
ConstraintLocator *locator);
636+
};
637+
618638
/// Mark function type as explicitly '@escaping'.
619639
class MarkExplicitlyEscaping final : public ContextualMismatch {
620640
MarkExplicitlyEscaping(ConstraintSystem &cs, Type lhs, Type rhs,

0 commit comments

Comments
 (0)