Skip to content

Commit 4eaa071

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 4705ec9 + 82c43a8 commit 4eaa071

35 files changed

+1410
-959
lines changed

CHANGELOG.md

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,68 @@ CHANGELOG
44
<details>
55
<summary>Note: This is in reverse chronological order, so newer entries are added to the top.</summary>
66

7-
| Version | Released | Toolchain |
8-
| :--------------------- | :--------- | :---------- |
9-
| [Swift 5.3](#swift-53) | | |
10-
| [Swift 5.2](#swift-52) | 2020-03-24 | Xcode 11.4 |
11-
| [Swift 5.1](#swift-51) | 2019-09-20 | Xcode 11.0 |
12-
| [Swift 5.0](#swift-50) | 2019-03-25 | Xcode 10.2 |
13-
| [Swift 4.2](#swift-42) | 2018-09-17 | Xcode 10.0 |
14-
| [Swift 4.1](#swift-41) | 2018-03-29 | Xcode 9.3 |
15-
| [Swift 4.0](#swift-40) | 2017-09-19 | Xcode 9.0 |
16-
| [Swift 3.1](#swift-31) | 2017-03-27 | Xcode 8.3 |
17-
| [Swift 3.0](#swift-30) | 2016-09-13 | Xcode 8.0 |
18-
| [Swift 2.2](#swift-22) | 2016-03-21 | Xcode 7.3 |
19-
| [Swift 2.1](#swift-21) | 2015-10-21 | Xcode 7.1 |
20-
| [Swift 2.0](#swift-20) | 2015-09-17 | Xcode 7.0 |
21-
| [Swift 1.2](#swift-12) | 2015-04-08 | Xcode 6.3 |
22-
| [Swift 1.1](#swift-11) | 2014-12-02 | Xcode 6.1.1 |
23-
| [Swift 1.0](#swift-10) | 2014-09-15 | Xcode 6.0 |
7+
| Version | Released | Toolchain |
8+
| :------------------------ | :--------- | :---------- |
9+
| [Swift Next](#swift-next) |
10+
| [Swift 5.3](#swift-53) | | |
11+
| [Swift 5.2](#swift-52) | 2020-03-24 | Xcode 11.4 |
12+
| [Swift 5.1](#swift-51) | 2019-09-20 | Xcode 11.0 |
13+
| [Swift 5.0](#swift-50) | 2019-03-25 | Xcode 10.2 |
14+
| [Swift 4.2](#swift-42) | 2018-09-17 | Xcode 10.0 |
15+
| [Swift 4.1](#swift-41) | 2018-03-29 | Xcode 9.3 |
16+
| [Swift 4.0](#swift-40) | 2017-09-19 | Xcode 9.0 |
17+
| [Swift 3.1](#swift-31) | 2017-03-27 | Xcode 8.3 |
18+
| [Swift 3.0](#swift-30) | 2016-09-13 | Xcode 8.0 |
19+
| [Swift 2.2](#swift-22) | 2016-03-21 | Xcode 7.3 |
20+
| [Swift 2.1](#swift-21) | 2015-10-21 | Xcode 7.1 |
21+
| [Swift 2.0](#swift-20) | 2015-09-17 | Xcode 7.0 |
22+
| [Swift 1.2](#swift-12) | 2015-04-08 | Xcode 6.3 |
23+
| [Swift 1.1](#swift-11) | 2014-12-02 | Xcode 6.1.1 |
24+
| [Swift 1.0](#swift-10) | 2014-09-15 | Xcode 6.0 |
2425

2526
</details>
2627

28+
Swift Next
29+
----------
30+
31+
* [SE-0287][]:
32+
33+
Implicit member expressions now support chains of member accesses, making the following valid:
34+
35+
```swift
36+
let milky: UIColor = .white.withAlphaComponent(0.5)
37+
let milky2: UIColor = .init(named: "white")!.withAlphaComponent(0.5)
38+
let milkyChance: UIColor? = .init(named: "white")?.withAlphaComponent(0.5)
39+
```
40+
41+
As is the case with the existing implicit member expression syntax, the resulting type of the chain must be the same as the (implicit) base, so it is not well-formed to write:
42+
43+
```swift
44+
let cgMilky: CGColor = .white.withAlphaComponent(0.5).cgColor
45+
```
46+
47+
(Unless, of course, appropriate `white` and `withAlphaComponent` members were defined on `CGColor`.)
48+
49+
Members of a "chain" can be properties, method calls, subscript accesses, force unwraps, or optional chaining question marks. Furthermore, the type of each member along the chain is permitted to differ (again, as long as the base of the chain matches the resulting type) meaning the following successfully typechecks:
50+
51+
```swift
52+
struct Foo {
53+
static var foo = Foo()
54+
static var bar = Bar()
55+
56+
var anotherFoo: Foo { Foo() }
57+
func getFoo() -> Foo { Foo() }
58+
var optionalFoo: Foo? { Foo() }
59+
subscript() -> Foo { Foo() }
60+
}
61+
62+
struct Bar {
63+
var anotherFoo = Foo()
64+
}
65+
66+
let _: Foo? = .bar.anotherFoo.getFoo().optionalFoo?.optionalFoo![]
67+
```
68+
2769
Swift 5.3
2870
---------
2971

@@ -8071,6 +8113,7 @@ Swift 1.0
80718113
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
80728114
[SE-0276]: <https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md>
80738115
[SE-0280]: <https://github.com/apple/swift-evolution/blob/master/proposals/0280-enum-cases-as-protocol-witnesses.md>
8116+
[SE-0287]: <https://github.com/apple/swift-evolution/blob/master/proposals/0287-implicit-member-chains.md>
80748117

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

0 commit comments

Comments
 (0)