Skip to content

Commit e4dc295

Browse files
committed
fix conflicts
2 parents 37edea6 + 4c2254b commit e4dc295

File tree

1,914 files changed

+82015
-54635
lines changed

Some content is hidden

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

1,914 files changed

+82015
-54635
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).

CHANGELOG.md

Lines changed: 103 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,107 @@ 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+
```
28108

29109
* [SR-11298][]:
30110

@@ -48,40 +128,6 @@ Swift Next
48128
}
49129
}
50130
```
51-
52-
As a result, this could lead to code that currently compiles today to throw an error.
53-
54-
```swift
55-
protocol Foo {
56-
var someProperty: Int { get set }
57-
}
58-
59-
class Bar: Foo {
60-
var someProperty = 0
61-
}
62-
63-
extension Foo where Self: Bar {
64-
var anotherProperty1: Int {
65-
get { return someProperty }
66-
// This will now error, because the protocol requirement
67-
// is implicitly mutating and the setter is implicitly
68-
// nonmutating.
69-
set { someProperty = newValue } // Error
70-
}
71-
}
72-
```
73-
74-
**Workaround**: Define a new mutable variable inside the setter that has a reference to `self`:
75-
76-
```swift
77-
var anotherProperty1: Int {
78-
get { return someProperty }
79-
set {
80-
var mutableSelf = self
81-
mutableSelf.someProperty = newValue // Okay
82-
}
83-
}
84-
```
85131

86132
* [SE-0253][]:
87133

@@ -145,6 +191,8 @@ Swift Next
145191
Swift 5.1
146192
---------
147193

194+
### 2019-09-20 (Xcode 11.0)
195+
148196
* [SR-8974][]:
149197

150198
Duplicate tuple element labels are no longer allowed, because it leads
@@ -7803,11 +7851,13 @@ Swift 1.0
78037851
[SR-1529]: <https://bugs.swift.org/browse/SR-1529>
78047852
[SR-2131]: <https://bugs.swift.org/browse/SR-2131>
78057853
[SR-2176]: <https://bugs.swift.org/browse/SR-2176>
7854+
[SR-2189]: <https://bugs.swift.org/browse/SR-2189>
78067855
[SR-2388]: <https://bugs.swift.org/browse/SR-2388>
78077856
[SR-2394]: <https://bugs.swift.org/browse/SR-2394>
78087857
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
78097858
[SR-2672]: <https://bugs.swift.org/browse/SR-2672>
78107859
[SR-2688]: <https://bugs.swift.org/browse/SR-2688>
7860+
[SR-2790]: <https://bugs.swift.org/browse/SR-2790>
78117861
[SR-4206]: <https://bugs.swift.org/browse/SR-4206>
78127862
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
78137863
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
@@ -7823,3 +7873,4 @@ Swift 1.0
78237873
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
78247874
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
78257875
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
7876+
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>

0 commit comments

Comments
 (0)