Skip to content

Commit 868fe50

Browse files
authored
Merge branch 'main' into rdar-74435602
2 parents 0d680aa + 1efcd3f commit 868fe50

File tree

391 files changed

+11890
-3089
lines changed

Some content is hidden

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

391 files changed

+11890
-3089
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ CHANGELOG
2828
Swift Next
2929
----------
3030

31+
* Whenever a reference to `Self` does not impede the usage of a protocol as a value type, or a protocol member on a value of protocol type, the same is now true for references to `[Self]` and `[Key : Self]`:
32+
33+
```swift
34+
protocol Copyable {
35+
func copy() -> Self
36+
func copy(count: Int) -> [Self]
37+
}
38+
39+
func test(c: Copyable) {
40+
let copy: Copyable = c.copy() // OK
41+
let copies: [Copyable] = c.copy(count: 5) // also OK
42+
}
43+
```
44+
3145
* [SE-0296][]:
3246

3347
Asynchronous programming is now natively supported using async/await. Asynchronous functions can be defined using `async`:
@@ -61,6 +75,19 @@ Swift Next
6175
}
6276
```
6377

78+
* [SE-0298][]:
79+
80+
The "for" loop can be used to traverse asynchronous sequences in asynchronous code:
81+
82+
```swift
83+
for try await line in myFile.lines() {
84+
// Do something with each line
85+
}
86+
```
87+
88+
Asynchronous for loops use asynchronous sequences, defined by the protocol
89+
`AsyncSequence` and its corresponding `AsyncIterator`.
90+
6491
**Add new entries to the top of this section, not here!**
6592

6693
Swift 5.4
@@ -8309,6 +8336,7 @@ Swift 1.0
83098336
[SE-0286]: <https://github.com/apple/swift-evolution/blob/main/proposals/0286-forward-scan-trailing-closures.md>
83108337
[SE-0287]: <https://github.com/apple/swift-evolution/blob/main/proposals/0287-implicit-member-chains.md>
83118338
[SE-0296]: <https://github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md>
8339+
[SE-0298]: <https://github.com/apple/swift-evolution/blob/main/proposals/0298-asyncsequence.md>
83128340

83138341
[SR-75]: <https://bugs.swift.org/browse/SR-75>
83148342
[SR-106]: <https://bugs.swift.org/browse/SR-106>

CMakeLists.txt

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ set(CMAKE_CXX_EXTENSIONS NO)
5050
# First include general CMake utilities.
5151
include(SwiftUtils)
5252
include(CheckSymbolExists)
53+
include(CMakeDependentOption)
5354

5455
#
5556
# User-configurable options that control the inclusion and default build
@@ -195,6 +196,13 @@ if(SWIFT_PROFDATA_FILE AND EXISTS ${SWIFT_PROFDATA_FILE})
195196
add_definitions("-fprofile-instr-use=${SWIFT_PROFDATA_FILE}")
196197
endif()
197198

199+
option(USE_SWIFT_ASYNC_LOWERING
200+
"Indicates if Swiftc should use async-specific lowering for async
201+
functions if it is supported for the target. The runtime also checks
202+
this setting before using async-specific attributes. This only applies
203+
to the async calling convention and not to the async context attribute."
204+
FALSE)
205+
198206
#
199207
# User-configurable Swift Standard Library specific options.
200208
#
@@ -406,6 +414,24 @@ option(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
406414
"Enable experimental Swift concurrency model"
407415
FALSE)
408416

417+
option(SWIFT_ENABLE_DISPATCH
418+
"Enable use of libdispatch"
419+
TRUE)
420+
421+
cmake_dependent_option(SWIFT_BUILD_SYNTAXPARSERLIB
422+
"Build the Swift Syntax Parser library" TRUE
423+
"SWIFT_ENABLE_DISPATCH" FALSE)
424+
cmake_dependent_option(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
425+
"Only build the Swift Syntax Parser library" FALSE
426+
"SWIFT_BUILD_SYNTAXPARSERLIB" FALSE)
427+
428+
cmake_dependent_option(SWIFT_BUILD_SOURCEKIT
429+
"Build SourceKit" TRUE
430+
"SWIFT_ENABLE_DISPATCH" FALSE)
431+
cmake_dependent_option(SWIFT_ENABLE_SOURCEKIT_TESTS
432+
"Enable running SourceKit tests" TRUE
433+
"SWIFT_BUILD_SOURCEKIT" FALSE)
434+
409435
#
410436
# End of user-configurable options.
411437
#
@@ -429,11 +455,6 @@ if(CMAKE_C_COMPILER_ID MATCHES Clang)
429455
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror=gnu>)
430456
endif()
431457

432-
option(SWIFT_BUILD_SYNTAXPARSERLIB "Build the Swift Syntax Parser library" TRUE)
433-
option(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB "Only build the Swift Syntax Parser library" FALSE)
434-
option(SWIFT_BUILD_SOURCEKIT "Build SourceKit" TRUE)
435-
option(SWIFT_ENABLE_SOURCEKIT_TESTS "Enable running SourceKit tests" ${SWIFT_BUILD_SOURCEKIT})
436-
437458
# Use dispatch as the system scheduler by default.
438459
# For convenience, we set this to false when concurrency is disabled.
439460
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)
@@ -442,14 +463,12 @@ if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND NOT SWIFT_STDLIB_SINGLE_THREADED_RU
442463
endif()
443464

444465
set(SWIFT_BUILD_HOST_DISPATCH FALSE)
445-
if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
446-
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
466+
if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
467+
if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
447468
set(SWIFT_BUILD_HOST_DISPATCH TRUE)
448469
endif()
449-
endif()
450470

451-
if(SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH)
452-
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
471+
if(SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH)
453472
if(NOT EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
454473
message(SEND_ERROR "SyntaxParserLib, SourceKit, and concurrency require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE")
455474
endif()
@@ -961,7 +980,9 @@ if (LLVM_ENABLE_DOXYGEN)
961980
message(STATUS "Doxygen: enabled")
962981
endif()
963982

964-
include(Libdispatch)
983+
if(SWIFT_ENABLE_DISPATCH)
984+
include(Libdispatch)
985+
endif()
965986

966987
# Add all of the subdirectories, where we actually do work.
967988

docs/ABI/Mangling.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,22 @@ types where the metadata itself has unknown layout.)
220220
global ::= global 'Tm' // merged function
221221
global ::= entity // some identifiable thing
222222
global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
223-
global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
224223
global ::= impl-function-type type 'Tz' // objc-to-swift-async completion handler block implementation
225224
global ::= impl-function-type type 'TZ' // objc-to-swift-async completion handler block implementation (predefined by runtime)
225+
global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
226+
global ::= impl-function-type type generic-signature? 'Tz' // objc-to-swift-async completion handler block implementation
227+
global ::= impl-function-type type generic-signature? 'TZ' // objc-to-swift-async completion handler block implementation (predefined by runtime)
226228
global ::= from-type to-type self-type generic-signature? 'Ty' // reabstraction thunk with dynamic 'Self' capture
227229
global ::= from-type to-type generic-signature? 'Tr' // obsolete mangling for reabstraction thunk
228230
global ::= entity generic-signature? type type* 'TK' // key path getter
229231
global ::= entity generic-signature? type type* 'Tk' // key path setter
230232
global ::= type generic-signature 'TH' // key path equality
231233
global ::= type generic-signature 'Th' // key path hasher
232234
global ::= global generic-signature? 'TJ' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' // autodiff function
235+
global ::= global generic-signature? 'TJV' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' // autodiff derivative vtable thunk
236+
global ::= from-type to-type 'TJO' AUTODIFF-FUNCTION-KIND // autodiff self-reordering reabstraction thunk
237+
global ::= from-type 'TJS' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' INDEX-SUBSET 'P' // autodiff linear map subset parameters thunk
238+
global ::= global to-type 'TJS' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' INDEX-SUBSET 'P' // autodiff derivative function subset parameters thunk
233239

234240
global ::= protocol 'TL' // protocol requirements base descriptor
235241
global ::= assoc-type-name 'Tl' // associated type descriptor

include/swift/ABI/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ class alignas(Alignment_DefaultActor) DefaultActor : public HeapObject {
4141

4242
} // end namespace swift
4343

44-
#endif
44+
#endif

include/swift/ABI/MetadataValues.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,9 +1936,9 @@ class JobFlags : public FlagSet<size_t> {
19361936

19371937
// Kind-specific flags.
19381938

1939-
Task_IsChildTask = 24,
1940-
Task_IsFuture = 25,
1941-
Task_IsTaskGroup = 26,
1939+
Task_IsChildTask = 24,
1940+
Task_IsFuture = 25,
1941+
Task_IsTaskGroup = 26
19421942
};
19431943

19441944
explicit JobFlags(size_t bits) : FlagSet(bits) {}
@@ -1965,11 +1965,9 @@ class JobFlags : public FlagSet<size_t> {
19651965
FLAGSET_DEFINE_FLAG_ACCESSORS(Task_IsFuture,
19661966
task_isFuture,
19671967
task_setIsFuture)
1968-
19691968
FLAGSET_DEFINE_FLAG_ACCESSORS(Task_IsTaskGroup,
19701969
task_isTaskGroup,
19711970
task_setIsTaskGroup)
1972-
19731971
};
19741972

19751973
/// Kinds of task status record.

0 commit comments

Comments
 (0)