Skip to content

Commit 21922a4

Browse files
authored
Merge branch 'master' into accelerate-vDSP-interpolation-tests
2 parents e96f61c + 0a3a130 commit 21922a4

File tree

3,975 files changed

+325725
-170697
lines changed

Some content is hidden

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

3,975 files changed

+325725
-170697
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.swift.gyb linguist-language=Swift
2+
*.cpp.gyb linguist-language=C++

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
33

44
<!-- If this pull request resolves any bugs in the Swift bug tracker, provide a link: -->
5-
Resolves [SR-NNNN](https://bugs.swift.org/browse/SR-NNNN).
5+
Resolves SR-NNNN.
66

77
<!--
88
Before merging this pull request, you must run the Swift continuous integration tests.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#==============================================================================#
2525
cscope.files
2626
cscope.out
27+
.vimrc
28+
tags
2729

2830
#==============================================================================#
2931
# Directories to ignore (do not add trailing '/'s, they skip symlinks).

.mailmap

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ Daniel Duan <[email protected]> <[email protected]>
2929
Dante Broggi <[email protected]>
3030
3131
32-
3332
3433
3534
36-
37-
David Rönnqvist <[email protected]>
35+
36+
David Rönnqvist <[email protected]>
3837
3938
4039
@@ -43,10 +42,8 @@ Davide Italiano <[email protected]> <[email protected]>
4342
4443
4544
46-
4745
4846
Erik Eckstein <[email protected]>
49-
5047
5148
Ewa Matejska <[email protected]>
5249
@@ -130,15 +127,13 @@ Ross Bayer <[email protected]>
130127
131128
132129
133-
134130
135131
Stephen Canon <[email protected]>
136132
137133
Sukolsak Sakshuwong <[email protected]>
138134
139135
140136
141-
142137
143138
144139

CHANGELOG.md

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

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

2424
</details>
2525

26-
Swift Next
27-
----------
26+
Swift 5.2
27+
---------
28+
29+
* [SR-2790][]:
30+
31+
The compiler will now emit a warning when attempting to pass a temporary
32+
pointer argument produced from an array, string, or inout argument to a
33+
parameter which is known to escape it. This includes the various initializers
34+
for the `UnsafePointer`/`UnsafeBufferPointer` family of types, as well as
35+
memberwise initializers.
36+
37+
```swift
38+
struct S {
39+
var ptr: UnsafePointer<Int8>
40+
}
41+
42+
func foo() {
43+
var i: Int8 = 0
44+
let ptr = UnsafePointer(&i)
45+
// warning: initialization of 'UnsafePointer<Int8>' results in a
46+
// dangling pointer
47+
48+
let s1 = S(ptr: [1, 2, 3])
49+
// warning: passing '[Int8]' to parameter, but argument 'ptr' should be a
50+
// pointer that outlives the call to 'init(ptr:)'
51+
52+
let s2 = S(ptr: "hello")
53+
// warning: passing 'String' to parameter, but argument 'ptr' should be a
54+
// pointer that outlives the call to 'init(ptr:)'
55+
}
56+
```
57+
58+
All 3 of the above examples are unsound because each argument produces a
59+
temporary pointer only valid for the duration of the call they are passed to.
60+
Therefore the returned value in each case references a dangling pointer.
61+
62+
* [SR-2189][]:
63+
64+
The compiler now supports local functions whose default arguments capture
65+
values from outer scopes.
66+
67+
```swift
68+
func outer(x: Int) -> (Int, Int) {
69+
func inner(y: Int = x) -> Int {
70+
return y
71+
}
72+
73+
return (inner(), inner(y: 0))
74+
}
75+
```
76+
77+
* [SR-11429][]:
78+
79+
The compiler will now correctly strip argument labels from function references
80+
used with the `as` operator in a function call. As a result, the `as` operator
81+
can now be used to disambiguate a call to a function with argument labels.
82+
83+
```swift
84+
func foo(x: Int) {}
85+
func foo(x: UInt) {}
86+
87+
(foo as (Int) -> Void)(5) // Calls foo(x: Int)
88+
(foo as (UInt) -> Void)(5) // Calls foo(x: UInt)
89+
```
90+
91+
Previously this was only possible for functions without argument labels.
92+
93+
This change also means that a generic type alias can no longer be used to
94+
preserve the argument labels of a function reference through the `as`
95+
operator. The following is now rejected:
96+
97+
```swift
98+
typealias Magic<T> = T
99+
func foo(x: Int) {}
100+
(foo as Magic)(x: 5) // error: Extraneous argument label 'x:' in call
101+
```
102+
103+
The function value must instead be called without argument labels:
104+
105+
```swift
106+
(foo as Magic)(5)
107+
```
108+
109+
* [SR-11298][]:
110+
111+
A class-constrained protocol extension, where the extended protocol does
112+
not impose a class constraint, will now infer the constraint implicitly.
113+
114+
```swift
115+
protocol Foo {}
116+
class Bar: Foo {
117+
var someProperty: Int = 0
118+
}
119+
120+
// Even though 'Foo' does not impose a class constraint, it is automatically
121+
// inferred due to the Self: Bar constraint.
122+
extension Foo where Self: Bar {
123+
var anotherProperty: Int {
124+
get { return someProperty }
125+
// As a result, the setter is now implicitly nonmutating, just like it would
126+
// be if 'Foo' had a class constraint.
127+
set { someProperty = newValue }
128+
}
129+
}
130+
```
131+
132+
* [SE-0253][]:
133+
134+
Values of types that declare `func callAsFunction` methods can be called
135+
like functions. The call syntax is shorthand for applying
136+
`func callAsFunction` methods.
137+
138+
```swift
139+
struct Adder {
140+
var base: Int
141+
func callAsFunction(_ x: Int) -> Int {
142+
return x + base
143+
}
144+
}
145+
var adder = Adder(base: 3)
146+
adder(10) // returns 13, same as `adder.callAsFunction(10)`
147+
```
148+
149+
* `func callAsFunction` argument labels are required at call sites.
150+
* Multiple `func callAsFunction` methods on a single type are supported.
151+
* `mutating func callAsFunction` is supported.
152+
* `func callAsFunction` works with `throws` and `rethrows`.
153+
* `func callAsFunction` works with trailing closures.
154+
155+
* [SR-4206][]:
156+
157+
A method override is no longer allowed to have a generic signature with
158+
requirements not imposed by the base method. For example:
159+
160+
```
161+
protocol P {}
162+
163+
class Base {
164+
func foo<T>(arg: T) {}
165+
}
166+
167+
class Derived: Base {
168+
override func foo<T: P>(arg: T) {}
169+
}
170+
```
171+
172+
will now be diagnosed as an error.
28173

29174
* [SR-6118][]:
30175

@@ -46,6 +191,30 @@ Swift Next
46191
Swift 5.1
47192
---------
48193

194+
### 2019-09-20 (Xcode 11.0)
195+
196+
* [SR-8974][]:
197+
198+
Duplicate tuple element labels are no longer allowed, because it leads
199+
to incorrect behavior. For example:
200+
201+
```
202+
let dupLabels: (foo: Int, foo: Int) = (foo: 1, foo: 2)
203+
204+
enum Foo { case bar(x: Int, x: Int) }
205+
let f: Foo = .bar(x: 0, x: 1)
206+
```
207+
208+
will now be diagnosed as an error.
209+
210+
Note: You can still use duplicate argument labels when declaring functions and
211+
subscripts, as long as the internal parameter names are different. For example:
212+
213+
```
214+
func foo(bar x: Int, bar y: Int) {}
215+
subscript(a x: Int, a y: Int) -> Int {}
216+
```
217+
49218
* [SE-0244][]:
50219

51220
Functions can now hide their concrete return type by declaring what protocols
@@ -197,7 +366,9 @@ Swift 5.1
197366
}
198367
```
199368

200-
* `weak` and `unowned` stored properties no longer inhibit the
369+
* [SR-9827][]:
370+
371+
`weak` and `unowned` stored properties no longer inhibit the
201372
automatic synthesis of `Equatable` or `Hashable` conformance.
202373

203374
* [SR-2688][]:
@@ -7668,6 +7839,7 @@ Swift 1.0
76687839
[SE-0244]: <https://github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md>
76697840
[SE-0245]: <https://github.com/apple/swift-evolution/blob/master/proposals/0245-array-uninitialized-initializer.md>
76707841
[SE-0252]: <https://github.com/apple/swift-evolution/blob/master/proposals/0252-keypath-dynamic-member-lookup.md>
7842+
[SE-0253]: <https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
76717843
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
76727844

76737845
[SR-106]: <https://bugs.swift.org/browse/SR-106>
@@ -7679,11 +7851,14 @@ Swift 1.0
76797851
[SR-1529]: <https://bugs.swift.org/browse/SR-1529>
76807852
[SR-2131]: <https://bugs.swift.org/browse/SR-2131>
76817853
[SR-2176]: <https://bugs.swift.org/browse/SR-2176>
7854+
[SR-2189]: <https://bugs.swift.org/browse/SR-2189>
76827855
[SR-2388]: <https://bugs.swift.org/browse/SR-2388>
76837856
[SR-2394]: <https://bugs.swift.org/browse/SR-2394>
76847857
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
76857858
[SR-2672]: <https://bugs.swift.org/browse/SR-2672>
76867859
[SR-2688]: <https://bugs.swift.org/browse/SR-2688>
7860+
[SR-2790]: <https://bugs.swift.org/browse/SR-2790>
7861+
[SR-4206]: <https://bugs.swift.org/browse/SR-4206>
76877862
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
76887863
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
76897864
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>
@@ -7694,4 +7869,8 @@ Swift 1.0
76947869
[SR-7799]: <https://bugs.swift.org/browse/SR-7799>
76957870
[SR-8109]: <https://bugs.swift.org/browse/SR-8109>
76967871
[SR-8546]: <https://bugs.swift.org/browse/SR-8546>
7872+
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
76977873
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
7874+
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
7875+
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
7876+
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>

0 commit comments

Comments
 (0)