Skip to content

Commit

Permalink
Merge pull request #5372 from swiftwasm/katei/merge-main-2023-04-06
Browse files Browse the repository at this point in the history
Merge main 2023-04-06
  • Loading branch information
kateinoigakukun committed Apr 25, 2023
2 parents e95edff + 023701c commit dacbf5f
Show file tree
Hide file tree
Showing 2,436 changed files with 163,433 additions and 102,660 deletions.
45 changes: 41 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

# include
/include/swift/AST/ @hborla @slavapestov @xedin
/include/swift/AST/*Availability* @tshortli
/include/swift/AST/*Conformance* @slavapestov
/include/swift/AST/*Distributed* @ktoso
/include/swift/AST/*Generic* @hborla @slavapestov
Expand All @@ -61,10 +62,14 @@
/include/swift/DependencyScan @artemcm
/include/swift/Driver @artemcm
# TODO: /include/swift/IRGen/
/include/swift/IDE/ @ahoppen @bnbarham @rintaro
/include/swift/Index/ @bnbarham
/include/swift/Refactoring @ahoppen @bnbarham
/include/swift/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
/include/swift/PrintAsClang @zoecarver @hyp @egorzhdan
# TODO: /include/swift/SIL/
# TODO: /include/swift/SILOptimizer/
/include/swift/SIL/SILDebug* @adrian-prantl
/include/swift/SILOptimizer/Utils/Distributed* @ktoso
/include/swift/Sema/ @hborla @slavapestov @xedin
/include/swift/Sema/CS* @hborla @xedin
Expand All @@ -73,6 +78,8 @@

# lib
/lib/AST/ @hborla @slavapestov @xedin
/lib/AST/*Availability* @tshortli
/lib/AST/ASTPrinter.cpp @hborla @slavapestov @xedin @tshortli
/lib/AST/*Conformance* @slavapestov
/lib/AST/*Generic* @hborla @slavapestov
/lib/AST/*Requirement* @hborla @slavapestov
Expand All @@ -83,19 +90,28 @@
/lib/ASTGen/ @zoecarver @CodaFi
/lib/Basic/Windows @compnerd
/lib/ClangImporter @zoecarver @hyp @egorzhdan
/lib/ClangImporter/DWARFImporter* @adrian-prantl
/lib/DependencyScan @artemcm
/lib/Driver @artemcm
/lib/Frontend/ModuleInterfaceLoader.cpp @artemcm
/lib/Frontend/*ModuleInterface* @artemcm @tshortli
# TODO: /lib/IRGen/
/lib/IDE/ @ahoppen @bnbarham @rintaro
/lib/IDETool/ @ahoppen @bnbarham @rintaro
/lib/Index/ @bnbarham
/lib/Refactoring/ @ahoppen @bnbarham
/lib/IRGen/*Debug* @adrian-prantl
/lib/IRGen/*Distributed* @ktoso
/lib/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
/lib/PrintAsClang @zoecarver @hyp @egorzhdan
# TODO: /lib/SIL/
/lib/SIL/IR/SILDebug* @adrian-prantl
/lib/SIL/IR/SILLocation* @adrian-prantl
# TODO: /lib/SILGen/
/lib/SILGen/*Distributed* @ktoso
# TODO: /lib/SILOptimizer/
/lib/SILOptimizer/Utils/Distributed* @ktoso
/lib/Sema/ @hborla @slavapestov @xedin
/lib/Sema/*Availability* @tshortli
/lib/Sema/CS* @hborla @xedin
/lib/Sema/CodeSynthesisDistributed* @hborla @ktoso
/lib/Sema/Constraint* @hborla @xedin
Expand All @@ -112,17 +128,24 @@

# stdlib
# TODO: /stdlib/
/stdlib/public/Backtracing/ @al45tair
/stdlib/public/Cxx/ @zoecarver @hyp @egorzhdan
/stdlib/public/Distributed/ @ktoso
/stdlib/public/Windows/ @compnerd
/stdlib/public/libexec/swift-backtrace/ @al45tair

# test
/test/ASTGen/ @zoecarver @CodaFi
/test/Constraints/ @hborla @xedin
/test/DebugInfo/ @adrian-prantl
/test/Distributed/ @ktoso
/test/Driver/ @artemcm
/test/Generics/ @hborla @slavapestov
# TODO: /test/IRGen/
/test/IDE/ @ahoppen @bnbarham @rintaro
/test/Index/ @bnbarham
/test/refactoring/ @ahoppen @bnbarham
/test/SourceKit/ @ahoppen @bnbarham @rintaro
/test/Interop/ @zoecarver @hyp @egorzhdan
/test/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
# TODO: /test/SIL/
Expand All @@ -141,25 +164,39 @@

# tools
# TODO: /tools
/tools/SourceKit @ahoppen @bnbarham @rintaro
/tools/lldb-moduleimport-test/ @adrian-prantl
/tools/swift-ide-test @ahoppen @bnbarham @rintaro
/tools/swift-refactor @ahoppen @bnbarham

# unittests
/unittests/AST/ @hborla @slavapestov @xedin
/unittests/AST/*Evaluator* @CodaFi @slavapestov
/unittests/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
# TODO: /unittests/SIL/
/unittests/Sema/ @hborla @xedin
/unittests/SourceKit/ @ahoppen @bnbarham @rintaro
# TODO: /unittests/stdlib/

# userdocs
# TODO: /userdocs

# utils
/utils/*windows* @compnerd
/utils/update-checkout* @shahmishal
/utils/update_checkout/ @shahmishal
/utils/*windows* @compnerd
/utils/gyb_sourcekit_support/ @ahoppen @bnbarham @rintaro
/utils/sourcekit_fuzzer/ @ahoppen @bnbarham @rintaro
/utils/swift_build_support/products/earlyswiftsyntax.py @ahoppen @bnbarham
/utils/swift_build_support/products/skstresstester.py @ahoppen @bnbarham
/utils/swift_build_support/products/sourcekitlsp.py @ahoppen @bnbarham
/utils/swift_build_support/products/swiftevolve.py @ahoppen @bnbarham
/utils/swift_build_support/products/swiftformat.py @ahoppen @allevato @bnbarham
/utils/swift_build_support/products/swiftsyntax.py @ahoppen @bnbarham
/utils/update-checkout* @shahmishal
/utils/update_checkout/ @shahmishal

# validation-test
# TODO: /validation-test/IRGen/
/validation-test/IDE/ @ahoppen @bnbarham @rintaro
/validation-test/Parse/ @ahoppen @bnbarham @CodaFi @DougGregor @rintaro
# TODO: /validation-test/SIL/
# TODO: /validation-test/SILGen/
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/build-matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"free_disk_space": true
},
{
"build_os": "macos-11",
"agent_query": "macos-11",
"build_os": "macos-12",
"agent_query": "macos-12",
"target": "macos_x86_64",
"run_stdlib_test": false,
"run_full_test": false,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
build-toolchain:
env:
TOOLCHAIN_CHANNEL: DEVELOPMENT
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer/
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer/
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 30
needs: [build-matrix]
Expand Down
146 changes: 120 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,100 @@
# CHANGELOG

_**Note:** This is in reverse chronological order, so newer entries are added to the top._
> **Note**\
> This is in reverse chronological order, so newer entries are added to the top.
## Swift 5.9

* [#64927][]:

Swift 5.9 introduces warnings that catch conversions from an inout
argument in the caller to an `UnsafeRawPointer` in the callee
whenever the original type contains an object reference.

```swift
func inspectString(string: inout String) {
readBytes(&string)
// warning: forming an 'UnsafeRawPointer' to an inout variable of type String
// exposes the internal representation rather than the string contents.
}
```

```swift
func inspectData(data: inout Data) {
readBytes(&data)
// warning: forming an 'UnsafeRawPointer' to a variable of type 'T';
// this is likely incorrect because 'T' may contain an object reference.
}
```

Please see the "Workarounds for common cases" section link in github
issue #64927.

* Marking stored properties as unavailable with `@available` has been banned,
closing an unintentional soundness hole that had allowed arbitrary
unavailable code to run and unavailable type metadata to be used at runtime:

```swift
@available(*, unavailable)
struct Unavailable {
init() {
print("Unavailable.init()")
}
}

struct S {
@available(*, unavailable)
var x = Unavailable()
}

_ = S() // prints "Unavailable.init()"
```

Marking `deinit` as unavailable has also been banned for similar reasons.

* [SE-0366][]:

The lifetime of a local variable value can be explicitly ended using the
`consume` operator, forwarding ownership to the surrounding call, assignment,
or initialization without copying:

```swift
var x: [String] = []
x.append("apples")
x.append("bananas")
x.append("oranges")

process(consume x) // forward the current value, without copying

x = [] // start building a new value
x.append("broccoli")
x.append("cauliflower")
x.append("asparagus")
...
```

* [SE-0377][]:

Functions can now declare whether they take value parameters by `borrowing`
access to a value provided by the caller, or by `consuming` a value that the
callee is allowed to take ownership of:

```swift
struct HealthyFoods {
var values: [String] = []

// Ask to `consume` the parameter, since we want to use it
// to incorporate into our own `values` array
mutating func add(_ value: consuming String) {
values.append(value)
}
}
```

## Swift 5.8

### 2023-03-30 (Xcode 14.3)

* [SE-0376][]:

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.
Expand Down Expand Up @@ -228,10 +319,10 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
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.

```swift
func delayedHello() async throws {
try await Task.sleep(until: .now + .milliseconds(123), clock: .continuous)
print("hello delayed world")
}
func delayedHello() async throws {
try await Task.sleep(until: .now + .milliseconds(123), clock: .continuous)
print("hello delayed world")
}
```

`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.
Expand All @@ -253,17 +344,17 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
`any` type having the same constraints as the associated type. For example:

```swift
protocol Surface {...}
protocol Solid {
associatedtype SurfaceType: Surface
func boundary() -> SurfaceType
}
let solid: any Solid = ...
// Type of 'boundary' is 'any Surface'
let boundary = solid.boundary()
protocol Surface {...}

protocol Solid {
associatedtype SurfaceType: Surface
func boundary() -> SurfaceType
}

let solid: any Solid = ...

// Type of 'boundary' is 'any Surface'
let boundary = solid.boundary()
```

Protocol methods that take an associated type or `Self` cannot be used with `any`,
Expand All @@ -276,32 +367,32 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
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:

```swift
protocol Graph<Vertex, Edge> {
associatedtype Vertex
associatedtype Edge
}
protocol Graph<Vertex, Edge> {
associatedtype Vertex
associatedtype Edge
}
```

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

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

extension Graph<Int, String> {...}
extension Graph<Int, String> {...}

func build() -> some Graph<Int, String> {}
func build() -> some Graph<Int, String> {}
```

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

```swift
func shortestPath<V, E, G>(_: G, from: V, to: V) -> [E]
where G: Graph, G.Vertex == V, G.Edge == E
func shortestPath<V, E, G>(_: G, from: V, to: V) -> [E]
where G: Graph, G.Vertex == V, G.Edge == E

extension Graph where Vertex == Int, Edge == String {...}
extension Graph where Vertex == Int, Edge == String {...}
```

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

[#64927]: <https://github.com/apple/swift/issues/64927>
[#42697]: <https://github.com/apple/swift/issues/42697>
[#42728]: <https://github.com/apple/swift/issues/42728>
[#43036]: <https://github.com/apple/swift/issues/43036>
Expand Down
Loading

0 comments on commit dacbf5f

Please sign in to comment.