Skip to content

Commit dacbf5f

Browse files
Merge pull request #5372 from swiftwasm/katei/merge-main-2023-04-06
Merge main 2023-04-06
2 parents e95edff + 023701c commit dacbf5f

File tree

2,436 files changed

+163433
-102660
lines changed

Some content is hidden

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

2,436 files changed

+163433
-102660
lines changed

.github/CODEOWNERS

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
# include
5252
/include/swift/AST/ @hborla @slavapestov @xedin
53+
/include/swift/AST/*Availability* @tshortli
5354
/include/swift/AST/*Conformance* @slavapestov
5455
/include/swift/AST/*Distributed* @ktoso
5556
/include/swift/AST/*Generic* @hborla @slavapestov
@@ -61,10 +62,14 @@
6162
/include/swift/DependencyScan @artemcm
6263
/include/swift/Driver @artemcm
6364
# TODO: /include/swift/IRGen/
65+
/include/swift/IDE/ @ahoppen @bnbarham @rintaro
66+
/include/swift/Index/ @bnbarham
67+
/include/swift/Refactoring @ahoppen @bnbarham
6468
/include/swift/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
6569
/include/swift/PrintAsClang @zoecarver @hyp @egorzhdan
6670
# TODO: /include/swift/SIL/
6771
# TODO: /include/swift/SILOptimizer/
72+
/include/swift/SIL/SILDebug* @adrian-prantl
6873
/include/swift/SILOptimizer/Utils/Distributed* @ktoso
6974
/include/swift/Sema/ @hborla @slavapestov @xedin
7075
/include/swift/Sema/CS* @hborla @xedin
@@ -73,6 +78,8 @@
7378

7479
# lib
7580
/lib/AST/ @hborla @slavapestov @xedin
81+
/lib/AST/*Availability* @tshortli
82+
/lib/AST/ASTPrinter.cpp @hborla @slavapestov @xedin @tshortli
7683
/lib/AST/*Conformance* @slavapestov
7784
/lib/AST/*Generic* @hborla @slavapestov
7885
/lib/AST/*Requirement* @hborla @slavapestov
@@ -83,19 +90,28 @@
8390
/lib/ASTGen/ @zoecarver @CodaFi
8491
/lib/Basic/Windows @compnerd
8592
/lib/ClangImporter @zoecarver @hyp @egorzhdan
93+
/lib/ClangImporter/DWARFImporter* @adrian-prantl
8694
/lib/DependencyScan @artemcm
8795
/lib/Driver @artemcm
88-
/lib/Frontend/ModuleInterfaceLoader.cpp @artemcm
96+
/lib/Frontend/*ModuleInterface* @artemcm @tshortli
8997
# TODO: /lib/IRGen/
98+
/lib/IDE/ @ahoppen @bnbarham @rintaro
99+
/lib/IDETool/ @ahoppen @bnbarham @rintaro
100+
/lib/Index/ @bnbarham
101+
/lib/Refactoring/ @ahoppen @bnbarham
102+
/lib/IRGen/*Debug* @adrian-prantl
90103
/lib/IRGen/*Distributed* @ktoso
91104
/lib/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
92105
/lib/PrintAsClang @zoecarver @hyp @egorzhdan
93106
# TODO: /lib/SIL/
107+
/lib/SIL/IR/SILDebug* @adrian-prantl
108+
/lib/SIL/IR/SILLocation* @adrian-prantl
94109
# TODO: /lib/SILGen/
95110
/lib/SILGen/*Distributed* @ktoso
96111
# TODO: /lib/SILOptimizer/
97112
/lib/SILOptimizer/Utils/Distributed* @ktoso
98113
/lib/Sema/ @hborla @slavapestov @xedin
114+
/lib/Sema/*Availability* @tshortli
99115
/lib/Sema/CS* @hborla @xedin
100116
/lib/Sema/CodeSynthesisDistributed* @hborla @ktoso
101117
/lib/Sema/Constraint* @hborla @xedin
@@ -112,17 +128,24 @@
112128

113129
# stdlib
114130
# TODO: /stdlib/
131+
/stdlib/public/Backtracing/ @al45tair
115132
/stdlib/public/Cxx/ @zoecarver @hyp @egorzhdan
116133
/stdlib/public/Distributed/ @ktoso
117134
/stdlib/public/Windows/ @compnerd
135+
/stdlib/public/libexec/swift-backtrace/ @al45tair
118136

119137
# test
120138
/test/ASTGen/ @zoecarver @CodaFi
121139
/test/Constraints/ @hborla @xedin
140+
/test/DebugInfo/ @adrian-prantl
122141
/test/Distributed/ @ktoso
123142
/test/Driver/ @artemcm
124143
/test/Generics/ @hborla @slavapestov
125144
# TODO: /test/IRGen/
145+
/test/IDE/ @ahoppen @bnbarham @rintaro
146+
/test/Index/ @bnbarham
147+
/test/refactoring/ @ahoppen @bnbarham
148+
/test/SourceKit/ @ahoppen @bnbarham @rintaro
126149
/test/Interop/ @zoecarver @hyp @egorzhdan
127150
/test/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
128151
# TODO: /test/SIL/
@@ -141,25 +164,39 @@
141164

142165
# tools
143166
# TODO: /tools
167+
/tools/SourceKit @ahoppen @bnbarham @rintaro
168+
/tools/lldb-moduleimport-test/ @adrian-prantl
169+
/tools/swift-ide-test @ahoppen @bnbarham @rintaro
170+
/tools/swift-refactor @ahoppen @bnbarham
144171

145172
# unittests
146173
/unittests/AST/ @hborla @slavapestov @xedin
147174
/unittests/AST/*Evaluator* @CodaFi @slavapestov
148175
/unittests/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
149176
# TODO: /unittests/SIL/
150177
/unittests/Sema/ @hborla @xedin
178+
/unittests/SourceKit/ @ahoppen @bnbarham @rintaro
151179
# TODO: /unittests/stdlib/
152180

153181
# userdocs
154182
# TODO: /userdocs
155183

156184
# utils
157-
/utils/*windows* @compnerd
158-
/utils/update-checkout* @shahmishal
159-
/utils/update_checkout/ @shahmishal
185+
/utils/*windows* @compnerd
186+
/utils/gyb_sourcekit_support/ @ahoppen @bnbarham @rintaro
187+
/utils/sourcekit_fuzzer/ @ahoppen @bnbarham @rintaro
188+
/utils/swift_build_support/products/earlyswiftsyntax.py @ahoppen @bnbarham
189+
/utils/swift_build_support/products/skstresstester.py @ahoppen @bnbarham
190+
/utils/swift_build_support/products/sourcekitlsp.py @ahoppen @bnbarham
191+
/utils/swift_build_support/products/swiftevolve.py @ahoppen @bnbarham
192+
/utils/swift_build_support/products/swiftformat.py @ahoppen @allevato @bnbarham
193+
/utils/swift_build_support/products/swiftsyntax.py @ahoppen @bnbarham
194+
/utils/update-checkout* @shahmishal
195+
/utils/update_checkout/ @shahmishal
160196

161197
# validation-test
162198
# TODO: /validation-test/IRGen/
199+
/validation-test/IDE/ @ahoppen @bnbarham @rintaro
163200
/validation-test/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
164201
# TODO: /validation-test/SIL/
165202
# TODO: /validation-test/SILGen/

.github/scripts/build-matrix.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"free_disk_space": true
5353
},
5454
{
55-
"build_os": "macos-11",
56-
"agent_query": "macos-11",
55+
"build_os": "macos-12",
56+
"agent_query": "macos-12",
5757
"target": "macos_x86_64",
5858
"run_stdlib_test": false,
5959
"run_full_test": false,

.github/workflows/build-toolchain.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
build-toolchain:
8181
env:
8282
TOOLCHAIN_CHANNEL: DEVELOPMENT
83-
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer/
83+
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer/
8484
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
8585
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 30
8686
needs: [build-matrix]

CHANGELOG.md

Lines changed: 120 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,100 @@
11
# CHANGELOG
22

3-
_**Note:** This is in reverse chronological order, so newer entries are added to the top._
3+
> **Note**\
4+
> This is in reverse chronological order, so newer entries are added to the top.
5+
6+
## Swift 5.9
7+
8+
* [#64927][]:
9+
10+
Swift 5.9 introduces warnings that catch conversions from an inout
11+
argument in the caller to an `UnsafeRawPointer` in the callee
12+
whenever the original type contains an object reference.
13+
14+
```swift
15+
func inspectString(string: inout String) {
16+
readBytes(&string)
17+
// warning: forming an 'UnsafeRawPointer' to an inout variable of type String
18+
// exposes the internal representation rather than the string contents.
19+
}
20+
```
21+
22+
```swift
23+
func inspectData(data: inout Data) {
24+
readBytes(&data)
25+
// warning: forming an 'UnsafeRawPointer' to a variable of type 'T';
26+
// this is likely incorrect because 'T' may contain an object reference.
27+
}
28+
```
29+
30+
Please see the "Workarounds for common cases" section link in github
31+
issue #64927.
32+
33+
* Marking stored properties as unavailable with `@available` has been banned,
34+
closing an unintentional soundness hole that had allowed arbitrary
35+
unavailable code to run and unavailable type metadata to be used at runtime:
36+
37+
```swift
38+
@available(*, unavailable)
39+
struct Unavailable {
40+
init() {
41+
print("Unavailable.init()")
42+
}
43+
}
44+
45+
struct S {
46+
@available(*, unavailable)
47+
var x = Unavailable()
48+
}
49+
50+
_ = S() // prints "Unavailable.init()"
51+
```
52+
53+
Marking `deinit` as unavailable has also been banned for similar reasons.
54+
55+
* [SE-0366][]:
56+
57+
The lifetime of a local variable value can be explicitly ended using the
58+
`consume` operator, forwarding ownership to the surrounding call, assignment,
59+
or initialization without copying:
60+
61+
```swift
62+
var x: [String] = []
63+
x.append("apples")
64+
x.append("bananas")
65+
x.append("oranges")
66+
67+
process(consume x) // forward the current value, without copying
68+
69+
x = [] // start building a new value
70+
x.append("broccoli")
71+
x.append("cauliflower")
72+
x.append("asparagus")
73+
...
74+
```
75+
76+
* [SE-0377][]:
77+
78+
Functions can now declare whether they take value parameters by `borrowing`
79+
access to a value provided by the caller, or by `consuming` a value that the
80+
callee is allowed to take ownership of:
81+
82+
```swift
83+
struct HealthyFoods {
84+
var values: [String] = []
85+
86+
// Ask to `consume` the parameter, since we want to use it
87+
// to incorporate into our own `values` array
88+
mutating func add(_ value: consuming String) {
89+
values.append(value)
90+
}
91+
}
92+
```
493

594
## Swift 5.8
695

96+
### 2023-03-30 (Xcode 14.3)
97+
798
* [SE-0376][]:
899

9100
The `@backDeployed(before:)` attribute may now be used to extend the availability of a function to OS releases prior to the introduction of that function as ABI.
@@ -228,10 +319,10 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
228319
New types representing time and clocks were introduced. This includes a protocol `Clock` defining clocks which allow for defining a concept of now and a way to wake up after a given instant. Additionally a new protocol `InstantProtocol` for defining instants in time was added. Furthermore a new protocol `DurationProtocol` was added to define an elapsed duration between two given `InstantProtocol` types. Most commonly the `Clock` types for general use are the `SuspendingClock` and `ContinuousClock` which represent the most fundamental clocks for the system. The `SuspendingClock` type does not progress while the machine is suspended whereas the `ContinuousClock` progresses no matter the state of the machine.
229320

230321
```swift
231-
func delayedHello() async throws {
232-
try await Task.sleep(until: .now + .milliseconds(123), clock: .continuous)
233-
print("hello delayed world")
234-
}
322+
func delayedHello() async throws {
323+
try await Task.sleep(until: .now + .milliseconds(123), clock: .continuous)
324+
print("hello delayed world")
325+
}
235326
```
236327

237328
`Clock` also has methods to measure the elapsed duration of the execution of work. In the case of the `SuspendingClock` and `ContinuousClock` this measures with high resolution and is suitable for benchmarks.
@@ -253,17 +344,17 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
253344
`any` type having the same constraints as the associated type. For example:
254345

255346
```swift
256-
protocol Surface {...}
257-
258-
protocol Solid {
259-
associatedtype SurfaceType: Surface
260-
func boundary() -> SurfaceType
261-
}
262-
263-
let solid: any Solid = ...
264-
265-
// Type of 'boundary' is 'any Surface'
266-
let boundary = solid.boundary()
347+
protocol Surface {...}
348+
349+
protocol Solid {
350+
associatedtype SurfaceType: Surface
351+
func boundary() -> SurfaceType
352+
}
353+
354+
let solid: any Solid = ...
355+
356+
// Type of 'boundary' is 'any Surface'
357+
let boundary = solid.boundary()
267358
```
268359

269360
Protocol methods that take an associated type or `Self` cannot be used with `any`,
@@ -276,32 +367,32 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
276367
Protocols can now declare a list of one or more _primary associated types_, which enable writing same-type requirements on those associated types using angle bracket syntax:
277368

278369
```swift
279-
protocol Graph<Vertex, Edge> {
280-
associatedtype Vertex
281-
associatedtype Edge
282-
}
370+
protocol Graph<Vertex, Edge> {
371+
associatedtype Vertex
372+
associatedtype Edge
373+
}
283374
```
284375

285376
You can now write a protocol name followed by type arguments in angle brackets, like
286377
`Graph<Int, String>`, anywhere that a protocol conformance requirement may appear:
287378

288379
```swift
289-
func shortestPath<V, E>(_: some Graph<V, E>, from: V, to: V) -> [E]
380+
func shortestPath<V, E>(_: some Graph<V, E>, from: V, to: V) -> [E]
290381

291-
extension Graph<Int, String> {...}
382+
extension Graph<Int, String> {...}
292383

293-
func build() -> some Graph<Int, String> {}
384+
func build() -> some Graph<Int, String> {}
294385
```
295386

296387
A protocol name followed by angle brackets is shorthand for a conformance requirement,
297388
together with a same-type requirement for the protocol's primary associated types.
298389
The first two examples above are equivalent to the following:
299390

300391
```swift
301-
func shortestPath<V, E, G>(_: G, from: V, to: V) -> [E]
302-
where G: Graph, G.Vertex == V, G.Edge == E
392+
func shortestPath<V, E, G>(_: G, from: V, to: V) -> [E]
393+
where G: Graph, G.Vertex == V, G.Edge == E
303394

304-
extension Graph where Vertex == Int, Edge == String {...}
395+
extension Graph where Vertex == Int, Edge == String {...}
305396
```
306397

307398
The `build()` function returning `some Graph<Int, String>` can't be written using a
@@ -9637,9 +9728,12 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
96379728
[SE-0358]: <https://github.com/apple/swift-evolution/blob/main/proposals/0358-primary-associated-types-in-stdlib.md>
96389729
[SE-0362]: <https://github.com/apple/swift-evolution/blob/main/proposals/0362-piecemeal-future-features.md>
96399730
[SE-0365]: <https://github.com/apple/swift-evolution/blob/main/proposals/0365-implicit-self-weak-capture.md>
9731+
[SE-0366]: <https://github.com/apple/swift-evolution/blob/main/proposals/0366-move-function.md>
96409732
[SE-0370]: <https://github.com/apple/swift-evolution/blob/main/proposals/0370-pointer-family-initialization-improvements.md>
96419733
[SE-0376]: <https://github.com/apple/swift-evolution/blob/main/proposals/0376-function-back-deployment.md>
9734+
[SE-0377]: <https://github.com/apple/swift-evolution/blob/main/proposals/0377-parameter-ownership-modifiers.md>
96429735

9736+
[#64927]: <https://github.com/apple/swift/issues/64927>
96439737
[#42697]: <https://github.com/apple/swift/issues/42697>
96449738
[#42728]: <https://github.com/apple/swift/issues/42728>
96459739
[#43036]: <https://github.com/apple/swift/issues/43036>

0 commit comments

Comments
 (0)