Skip to content

Commit ab9e74c

Browse files
Resolve conflicts with upstream
2 parents 57bddb7 + cfeece9 commit ab9e74c

File tree

2,843 files changed

+124761
-59528
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,843 files changed

+124761
-59528
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Byte compiled python modules.
1717
*.pyc
1818
# vim swap files
19-
.*.swp
19+
.*.sw[a-z]
2020
.sw?
2121

2222
#==============================================================================#
@@ -39,3 +39,4 @@ docs/_build
3939
#==============================================================================#
4040
CMakeCache.txt
4141
CMakeFiles
42+
.atom-build.json

.pep8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[flake8]
2-
filename = *.py,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,gyb,line-directive,ns-html2rst,recursive-lipo,rth,submit-benchmark-results,update-checkout,viewcfg
2+
filename = *.py,80+-check,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,gyb,line-directive,mock-distcc,ns-html2rst,recursive-lipo,rth,split-generated-tests,submit-benchmark-results,update-checkout,viewcfg

CHANGELOG.md

Lines changed: 170 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,149 @@
1+
Note: This is in reverse chronological order, so newer entries are added to the top.
12

23
Swift 3.0
3-
-------
4+
---------
5+
6+
* [SE-0071](https://github.com/apple/swift-evolution/blob/master/proposals/0071-member-keywords.md):
7+
"Allow (most) keywords in member references" is implemented. This allows the
8+
use of members after a dot without backticks, e.g. "foo.default".
9+
10+
* [SE-0057](https://github.com/apple/swift-evolution/blob/master/proposals/0057-importing-objc-generics.md):
11+
Objective-C lightweight generic classes are now imported as generic types
12+
in Swift. Because Objective-C generics are not represented at runtime,
13+
there are some limitations on what can be done with them in Swift:
14+
15+
- If an ObjC generic class is used in a checked `as?`, `as!`, or `is` cast,
16+
the generic parameters are not checked at runtime. The cast succeeds if the
17+
operand is an instance of the ObjC class, regardless of parameters.
18+
19+
```swift
20+
let x = NSFoo<NSNumber>(value: NSNumber(integer: 0))
21+
let y: AnyObject = x
22+
let z = y as! NSFoo<NSString> // Succeeds
23+
```
24+
25+
- Swift subclasses can only inherit an ObjC generic class if its generic
26+
parameters are fully specified.
27+
28+
```swift
29+
// Error: Can't inherit ObjC generic class with unbound parameter T
30+
class SwiftFoo1<T>: NSFoo<T> { }
31+
32+
// OK: Can inherit ObjC generic class with specific parameters
33+
class SwiftFoo2<T>: NSFoo<NSString> { }
34+
```
35+
36+
- Swift can extend ObjC generic classes, but the extensions cannot be
37+
constrained, and definitions inside the extension do not have access to
38+
the class's generic parameters.
39+
40+
```swift
41+
extension NSFoo {
42+
// Error: Can't access generic param T
43+
func foo() -> T {
44+
return T()
45+
}
46+
}
47+
48+
// Error: extension can't be constrained
49+
extension NSFoo where T: NSString {
50+
}
51+
```
52+
53+
- Foundation container classes `NS[Mutable]Array`, `NS[Mutable]Set`, and
54+
`NS[Mutable]Dictionary` are still imported as nongeneric classes for
55+
the time being.
56+
57+
* As part of the changes for SE-0055 (see below), the *pointee* types of
58+
imported pointers (e.g. the `id` in `id *`) are no longer assumed to always
59+
be `_Nullable` even if annotated otherwise. However, an implicit or explicit
60+
annotation of `_Null_unspecified` on a pointee type is still imported as
61+
`Optional`.
62+
63+
* [SE-0055](https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md):
64+
The types `UnsafePointer`, `UnsafeMutablePointer`,
65+
`AutoreleasingUnsafeMutablePointer`, `OpaquePointer`, `Selector`, and `Zone`
66+
(formerly `NSZone`) now represent non-nullable pointers, i.e. pointers that
67+
are never `nil`. A nullable pointer is now represented using `Optional`, e.g.
68+
`UnsafePointer<Int>?` For types imported from C, non-object pointers (such as
69+
`int *`) now have their nullability taken into account.
70+
71+
One possible area of difficulty is passing a nullable pointer to a function
72+
that uses C variadics. Swift will not permit this directly, so as a
73+
workaround please use the following idiom to pass it as a pointer-sized
74+
integer value instead:
75+
76+
```swift
77+
unsafeBitCast(nullablePointer, to: Int.self)
78+
```
79+
80+
* [SE-0046] (https://github.com/apple/swift-evolution/blob/master/proposals/0046-first-label.md) Function parameters now have consistent labelling across all function parameters. With this update the first parameter declarations will now match the existing behavior of the second and later parameters. This change makes the language simpler.
81+
82+
Functions that were written and called as follows
83+
```swift
84+
func foo(x: Int, y: Int) {
85+
}
86+
foo(1, y: 2)
87+
88+
func bar(a a: Int, b: Int) {
89+
}
90+
bar(a: 3, b: 4)
91+
```
92+
will now be written as (to achieve the same behavior):
93+
```swift
94+
func foo(_ x: Int, y: Int) {}
95+
foo(1, y: 2)
96+
func bar(a: Int, b: Int) {}
97+
bar(a: 3, b: 4)
98+
```
99+
100+
* [SE-0037](https://github.com/apple/swift-evolution/blob/master/proposals/0037-clarify-comments-and-operators.md)
101+
Comments are now treated as whitespace when determining whether an operator is
102+
prefix, postfix, or binary. For example, these now work:
103+
```swift
104+
if /*comment*/!foo { ... }
105+
1 +/*comment*/2
106+
```
107+
108+
This also means that comments can no longer appear between a unary operator
109+
and its argument.
110+
```swift
111+
foo/* comment */! // no longer works
112+
```
113+
114+
Any parse errors resulting from this change can be resolved by moving the
115+
comment outside of the expression.
116+
117+
* [SE-0031](https://github.com/apple/swift-evolution/blob/master/proposals/0031-adjusting-inout-declarations.md) The location of the inout attribute has been moved to after the `:` and before the parameter type.
118+
```swift
119+
func foo(inout x: Int) {
120+
}
121+
```
122+
will now be written as:
123+
```swift
124+
func foo(x: inout Int) {
125+
}
126+
```
127+
128+
* [SE-0053](https://github.com/apple/swift-evolution/blob/master/proposals/0053-remove-let-from-function-parameters.md) `let` is no longer accepted as a parameter attribute for functions. The compiler provides a fixit to remove it from the function declaration.
129+
130+
* [SE-0003](https://github.com/apple/swift-evolution/blob/master/proposals/0003-remove-var-parameters.md) `var` is no longer accepted as a parameter attribute for functions. The compiler provides a fixit to create a shadow copy in the function body.
131+
```swift
132+
func foo(var x: Int) {
133+
}
134+
```
135+
will now be written as:
136+
```swift
137+
func foo(x: Int) {
138+
var x = x
139+
}
140+
```
141+
142+
* The "none" members of imported NS_OPTIONS option sets are marked as unavailable
143+
when they are imported. Use [] to make an empty option set, instead of a None member.
144+
145+
* [SE-0043](https://github.com/apple/swift-evolution/blob/master/proposals/0043-declare-variables-in-case-labels-with-multiple-patterns.md)
146+
landed, adding the ability to declare variables in multiple patterns in cases.
4147

5148
* Renamification landed, so the Clang importer imports ObjC symbols
6149
substantially differently. *Someone should expand on this point.*
@@ -14,7 +157,7 @@ Swift 3.0
14157
typealias StringDictionary<T> = Dictionary<String, T>
15158
typealias IntFunction<T> = (T) -> Int
16159
typealias MatchingTriple<T> = (T, T, T)
17-
typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)
160+
typealias BackwardTriple<T1, T2, T3> = (T3, T2, T1)
18161
```
19162
etc.
20163

@@ -61,6 +204,13 @@ Swift 3.0
61204
}
62205
}
63206
```
207+
* Throwing closure arguments of a rethrowing function may now be optional. For example:
208+
209+
```swift
210+
func executeClosureIfNotNil(closure: (() throws -> Void)?) rethrows {
211+
try closure?()
212+
}
213+
```
64214

65215
Swift 2.2
66216
---------
@@ -77,7 +227,7 @@ Swift 2.2
77227
The `typealias` keyword is still allowed (but deprecated and produces a warning)
78228
in Swift 2.2. This warning will become an error in Swift 3.0.
79229

80-
* Curried function syntax has been deprecated, and is slated to be removed in
230+
* Curried function syntax has been deprecated, and is slated to be removed in
81231
Swift 3.0.
82232

83233
* The `++` and `--` operators have been deprecated, and are slated to be removed in
@@ -94,12 +244,12 @@ Swift 2.2
94244
```
95245

96246
should move to being written as:
97-
247+
98248
```swift
99249
foo(x.0, x.b)
100250
```
101251

102-
For more information and rationale, see
252+
For more information and rationale, see
103253
[SE-0029](https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md).
104254

105255
* New `#file`, `#line`, `#column`, and `#function` expressions have been introduced to
@@ -217,7 +367,7 @@ Swift 2.2
217367

218368
let buttonFactory = UIButton.init(type:)
219369
```
220-
370+
221371
For more information, see [SE-0021](https://github.com/apple/swift-evolution/blob/master/proposals/0021-generalized-naming.md).
222372

223373
* There is a new build configuration function, `#if swift(>=x.y)`, which
@@ -244,14 +394,14 @@ Swift 2.2
244394
```swift
245395
let sel = #selector(insertSubview(_:aboveSubview:)) // sel has type Selector
246396
```
247-
397+
248398
Along with this change, the use of string literals as selectors has
249399
been deprecated, e.g.,
250400

251401
```swift
252402
let sel: Selector = "insertSubview:aboveSubview:"
253403
```
254-
404+
255405
Generally, such string literals should be replaced with uses of
256406
`#selector`, and the compiler will provide Fix-Its that use
257407
`#selector`. In cases where this is not possible (e.g., when referring
@@ -261,7 +411,7 @@ Swift 2.2
261411
```swift
262412
let sel = Selector("propertyName")
263413
```
264-
414+
265415
Note that the compiler is now checking the string literals used to
266416
construct Selectors to ensure that they are well-formed Objective-C
267417
selectors and that there is an `@objc` method with that selector.
@@ -790,8 +940,8 @@ Swift 2.2
790940
value for the enum to be stored indirectly, allowing for recursive data
791941
structures to be defined. For example:
792942

793-
```swift
794-
enum List<T> {
943+
```swift
944+
enum List<T> {
795945
case Nil
796946
indirect case Cons(head: T, tail: List<T>)
797947
}
@@ -1039,7 +1189,7 @@ Swift 2.2
10391189
needs to be written as:
10401190

10411191
```swift
1042-
var (a,b) : (Int, Float) = foo()
1192+
var (a, b) : (Int, Float) = foo()
10431193
```
10441194

10451195
if an explicit type annotation is needed. The former syntax was ambiguous
@@ -1835,10 +1985,10 @@ Swift 2.2
18351985
2014-10-09 [Roughly Xcode 6.1, and Swift 1.1]
18361986
----------
18371987

1838-
* `HeapBuffer<Value,Element>`, `HeapBufferStorage<Value,Element>`, and
1988+
* `HeapBuffer<Value, Element>`, `HeapBufferStorage<Value, Element>`, and
18391989
`OnHeap<Value>` were never really useful, because their APIs were
18401990
insufficiently public. They have been replaced with a single class,
1841-
`ManagedBuffer<Value,Element>`. See also the new function
1991+
`ManagedBuffer<Value, Element>`. See also the new function
18421992
`isUniquelyReferenced(x)` which is often useful in conjunction with
18431993
`ManagedBuffer`.
18441994

@@ -1941,7 +2091,7 @@ Swift 2.2
19412091
```swift
19422092
enum Foo: Int { case A = 0, B = 1, C = 2 }
19432093
let foo = Foo(rawValue: 2)! // formerly 'Foo.fromRaw(2)!'
1944-
println(foo.rawValue) // formerly 'foo.toRaw()'
2094+
println(foo.rawValue) // formerly 'foo.toRaw()'
19452095
```
19462096

19472097
2014-09-02
@@ -2646,7 +2796,7 @@ Swift 2.2
26462796

26472797
In many common cases, this will just work. Unfortunately, values
26482798
are returned from `CF`-style APIs in a wide variety of ways, and
2649-
unlike Objective C methods, there simply isn't enough consistency
2799+
unlike Objective-C methods, there simply isn't enough consistency
26502800
for Swift to be able to safely apply the documented conventions
26512801
universally. The framework teams have already audited many of the
26522802
most important `CF`-style APIs, and those APIs should be imported
@@ -3875,15 +4025,15 @@ Swift 2.2
38754025

38764026
```swift
38774027
func swap<T>(a : @inout T, b : @inout T) {
3878-
(a,b) = (b,a)
4028+
(a, b) = (b, a)
38794029
}
38804030
```
38814031

38824032
You are now required to write:
38834033

38844034
```swift
38854035
func swap<T>(inout a : T, inout b : T) {
3886-
(a,b) = (b,a)
4036+
(a, b) = (b, a)
38874037
}
38884038
```
38894039

@@ -4744,8 +4894,8 @@ Swift 2.2
47444894
* Array and dictionary literals allow an optional trailing comma:
47454895

47464896
```swift
4747-
var a = [ 1, 2, ]
4748-
var d = [ "a": 1, "b": 2, ]
4897+
var a = [1, 2,]
4898+
var d = ["a": 1, "b": 2,]
47494899
```
47504900

47514901
2013-10-16

0 commit comments

Comments
 (0)