@@ -23,12 +23,49 @@ CHANGELOG
23
23
24
24
Swift 5.0
25
25
---------
26
+
27
+ * Swift 3 mode has been removed. Supported values for the ` -swift-version `
28
+ flag are ` 4 ` , ` 4.2 ` , and ` 5 ` .
29
+
30
+ * [ SE-0228] [ ] :
31
+
32
+ String interpolation has been overhauled to improve its performance,
33
+ clarity, and efficiency.
34
+
35
+ Note that the old ` _ExpressibleByStringInterpolation ` protocol has been
36
+ removed; any code making use of this protocol will need to be updated
37
+ for the new design. An ` #if compiler ` block can be used to conditionalize
38
+ code between 4.2 and 5.0, for example:
39
+
40
+ ``` swift
41
+ #if compiler (< 5.0 )
42
+ extension MyType : _ExpressibleByStringInterpolation { ... }
43
+ #else
44
+ extension MyType : ExpressibleByStringInterpolation { ... }
45
+ #endif
46
+ ```
47
+
48
+ * [ SE-0213] [ ] :
49
+
50
+ If ` T ` conforms to one of the ` ExpressibleBy* ` protocols and ` literal ` is a
51
+ literal expression, then ` T(literal) ` will construct a literal of type ` T `
52
+ using the corresponding protocol, rather than calling a constructor member
53
+ of ` T ` with a value of the protocol's default literal type.
54
+
55
+ For example, expressions like ` UInt64(0xffff_ffff_ffff_ffff) ` are now valid,
56
+ where previously they would overflow the default integer literal type of ` Int ` .
57
+
58
+ * [ SE-0230] [ ] :
59
+
60
+ In Swift 5 mode, ` try? ` with an expression of Optional type will flatten the
61
+ resulting Optional, instead of returning an Optional of an Optional.
62
+
26
63
* [ SR-5719] [ ] :
27
64
28
- Starting from ` -swift-version 5 ` , implicit ` @autoclosure ` function type
29
- forwarding has been disabled, and new a diagnostic has been added suggesting
30
- to add ` () ` to call the function value in such case. The call itself would be
31
- wrapped in an implicit closure and passed to the corresponding parameter .
65
+ In Swift 5 mode, ` @autoclosure ` parameters can no longer be forwarded to
66
+ ` @autoclosure ` arguments in another function call. Instead, you must explicitly
67
+ call the function value with ` () ` ; the call itself is wrapped inside an
68
+ implicit closure, guaranteeing the same behavior as in Swift 4 mode .
32
69
33
70
Example:
34
71
@@ -40,6 +77,56 @@ Swift 5.0
40
77
}
41
78
```
42
79
80
+ * [ SR-8109] [ ] :
81
+
82
+ Single-element labeled tuple expressions, for example ` (label: 123) ` , were
83
+ allowed in some contexts but often resulted in surprising, inconsistent
84
+ behavior that varied across compiler releases. They are now completely
85
+ disallowed.
86
+
87
+ Note that single-element labeled _ types_ , for example ` var x: (label: Int) ` ,
88
+ have already been prohibited since Swift 3.
89
+
90
+ * [ SR-695] [ ] :
91
+
92
+ In Swift 5 mode, a class method returning ` Self ` can no longer be overridden
93
+ with a method returning a non-final concrete class type. Such code is not
94
+ type safe and will need to be updated.
95
+
96
+ For example,
97
+
98
+ ``` swift
99
+ class Base {
100
+ class func factory () -> Self { ... }
101
+ }
102
+
103
+ class Derived : Base {
104
+ class override func factory() -> Derived { ... }
105
+ }
106
+ ```
107
+
108
+ * In Swift 5 mode, the type of ` self ` in a convenience initializer of a non-final
109
+ class is now the dynamic ` Self ` type, and not the concrete class type.
110
+
111
+ * [ SR-5581] [ ] :
112
+
113
+ Protocols can now constrain their conforming types to those that subclasses a
114
+ given class. Two equivalent forms are supported:
115
+
116
+ ``` swift
117
+ protocol MyView : UIView { ... }
118
+ protocol MyView where Self : UIView { ... }
119
+ ```
120
+
121
+ Note that Swift 4.2 accepted the second form, but it was not fully implemented
122
+ and could sometimes crash at compile time or run time.
123
+
124
+ * [ SR-631] [ ] :
125
+
126
+ Extension binding now supports extensions of nested types which themselves are
127
+ defined inside extensions. Previously this could fail with some declaration orders,
128
+ producing spurious "undeclared type" errors.
129
+
43
130
* [ SR-7139] [ ] :
44
131
45
132
Exclusive memory access is now enforced at runtime by default in
@@ -129,16 +216,24 @@ Swift 5.0
129
216
130
217
* [SE- 0214 ][]:
131
218
132
- Renamed the `DictionaryLiteral ` type to `KeyValuePairs`.
219
+ The `DictionaryLiteral ` type has been renamed to `KeyValuePairs`.
133
220
A typealias preserves the old name for compatibility.
134
221
135
222
* [SR- 2608 ][]
136
223
137
224
Default arguments are now printed in SourceKit- generated interfaces for Swift
138
225
modules, instead of just using a placeholder `default `.
139
226
140
- * Notable bug fix: unowned and unowned(unsafe) variables now support optional
141
- types.
227
+ * `unowned ` and `unowned(unsafe) ` variables now support Optional types.
228
+
229
+ * Designated initializers with variadic parameters are now correctly inherited
230
+ in subclasses.
231
+
232
+ * Extensions of concrete subclasses of generic classes can now contain
233
+ `@objc ` members.
234
+
235
+ * Complex recursive type definitions involving classes and generics that would
236
+ previously cause deadlocks at run time are now fully supported.
142
237
143
238
* [SR- 419 ][]
144
239
@@ -7309,9 +7404,13 @@ Swift 1.0
7309
7404
[SE- 0225 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0225-binaryinteger-iseven-isodd-ismultiple.md>
7310
7405
[SE- 0226 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0226-package-manager-target-based-dep-resolution.md>
7311
7406
[SE- 0227 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0227-identity-keypath.md>
7407
+ [SE- 0228 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0228-fix-expressiblebystringinterpolation.md>
7408
+ [SE- 0230 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0230-flatten-optional-try.md>
7312
7409
7313
7410
[SR- 106 ]: < https: // bugs.swift.org/browse/SR-106>
7314
7411
[SR- 419 ]: < https: // bugs.swift.org/browse/SR-419>
7412
+ [SR- 631 ]: < https: // bugs.swift.org/browse/SR-631>
7413
+ [SR- 695 ]: < https: // bugs.swift.org/browse/SR-695>
7315
7414
[SR- 1009 ]: < https: // bugs.swift.org/browse/SR-1009>
7316
7415
[SR- 1446 ]: < https: // bugs.swift.org/browse/SR-1446>
7317
7416
[SR- 1529 ]: < https: // bugs.swift.org/browse/SR-1529>
@@ -7320,6 +7419,8 @@ Swift 1.0
7320
7419
[SR- 2394 ]: < https: // bugs.swift.org/browse/SR-2394>
7321
7420
[SR- 2608 ]: < https: // bugs.swift.org/browse/SR-2608>
7322
7421
[SR- 4248 ]: < https: // bugs.swift.org/browse/SR-4248>
7422
+ [SR- 5581 ]: < https: // bugs.swift.org/browse/SR-5581>
7423
+ [SR- 5719 ]: < https: // bugs.swift.org/browse/SR-5719>
7323
7424
[SR- 7139 ]: < https: // bugs.swift.org/browse/SR-7139>
7324
7425
[SR- 7251 ]: < https: // bugs.swift.org/browse/SR-7251>
7325
- [SR- 5719 ]: < https: // bugs.swift.org/browse/SR-5719 >
7426
+ [SR- 8109 ]: < https: // bugs.swift.org/browse/SR-8109 >
0 commit comments