Skip to content

Commit 1acde5a

Browse files
author
Davide Italiano
committed
---
yaml --- r: 284031 b: refs/heads/master-next c: 5dec537 h: refs/heads/master i: 284029: f82580e 284027: 4ad9e57 284023: 757092e 284015: 99ab5a7 283999: cb04d4c 283967: 35b3ced 283903: 6d80e22
1 parent a609bae commit 1acde5a

File tree

565 files changed

+7991
-42255
lines changed

Some content is hidden

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

565 files changed

+7991
-42255
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 913a1f57faca996135623c287c09060d8d0532ec
3-
refs/heads/master-next: 0e60b633b58e48c255912dec1fb0356d6cb42d49
3+
refs/heads/master-next: 5dec5371733e4668cb16e79610050321cc778536
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/CHANGELOG.md

Lines changed: 8 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CHANGELOG
66

77
| Contents |
88
| :--------------------- |
9-
| [Swift Next](#swift-next) |
109
| [Swift 5.1](#swift-51) |
1110
| [Swift 5.0](#swift-50) |
1211
| [Swift 4.2](#swift-42) |
@@ -23,162 +22,12 @@ CHANGELOG
2322

2423
</details>
2524

26-
Swift Next
27-
----------
28-
29-
* [SR-6118][]:
30-
31-
Subscripts can now declare default arguments:
32-
33-
```swift
34-
struct Subscriptable {
35-
subscript(x: Int, y: Int = 0) {
36-
...
37-
}
38-
}
39-
40-
let s = Subscriptable()
41-
print(s[0])
42-
```
43-
44-
**Add new entries to the top of this section, not here!**
45-
4625
Swift 5.1
4726
---------
4827

49-
* [SE-0244][]:
50-
51-
Functions can now hide their concrete return type by declaring what protocols
52-
it conforms to instead of specifying the exact return type:
53-
54-
```
55-
func makeMeACollection() -> some Collection {
56-
return [1, 2, 3]
57-
}
58-
```
59-
60-
Code that calls the function can use the interface of the protocol, but
61-
does not have visibility into the underlying type.
62-
63-
* [SE-0254][]:
64-
65-
Subscripts can now be declared `static` or (inside classes) `class`.
66-
67-
* [SE-0252][]:
68-
69-
The existing `@dynamicMemberLookup` attribute has been extended with a
70-
support for strongly-typed keypath implementations:
71-
72-
```swift
73-
@dynamicMemberLookup
74-
struct Lens<T> {
75-
let getter: () -> T
76-
let setter: (T) -> Void
77-
78-
var value: T {
79-
get {
80-
return getter()
81-
}
82-
set {
83-
setter(newValue)
84-
}
85-
}
86-
87-
subscript<U>(dynamicMember keyPath: WritableKeyPath<T, U>) -> Lens<U> {
88-
return Lens<U>(
89-
getter: { self.value[keyPath: keyPath] },
90-
setter: { self.value[keyPath: keyPath] = $0 })
91-
}
92-
}
93-
```
94-
95-
* [SR-8546][], [SR-9043][]:
96-
97-
More thorough checking has been implemented for restrictions around
98-
escaping closures capturing `inout` parameters or values of noescape type.
99-
While most code should not be affected, there are edge cases where
100-
the Swift 5.0 compiler would accept code violating these restrictions.
101-
This could result in runtime crashes or silent data corruption.
102-
103-
An example of invalid code which was incorrectly accepted by the Swift 5.0
104-
compiler is an `@escaping` closure calling a local function which
105-
references an `inout` parameter from an outer scope:
106-
107-
```swift
108-
struct BadCaptureExample {
109-
var escapingClosure: () -> ()
110-
111-
mutating func takesInOut(_ x: inout Int) {
112-
func localFunction() {
113-
x += 1
114-
}
115-
116-
escapingClosure = { localFunction() }
117-
}
118-
}
119-
```
120-
121-
The compiler now correctly diagnoses the above code by pointing out that
122-
the capture of `x` by `localFunction()` is invalid, since `localFunction()`
123-
is referenced from an `@escaping` closure.
124-
125-
This also addresses certain cases where the compiler incorrectly diagnosed
126-
certain code as invalid, when in fact no violation of restrictions had
127-
taken place. For example,
128-
129-
```swift
130-
func takesNoEscape(_ fn: () -> ()) {
131-
func localFunction() {
132-
fn()
133-
}
134-
135-
{ localFunction() }()
136-
}
137-
```
138-
139-
* [SR-2672][]:
140-
141-
Conversions between tuple types are now fully implemented.
142-
Previously, the following would diagnose an error:
143-
144-
```swift
145-
let values: (Int, Int) = (10, 15)
146-
let converted: (Int?, Any) = values
147-
148-
* [SE-0242][]:
149-
150-
The memberwise initializer for structures now provide default values for variables that hold default expressions.
151-
152-
```swift
153-
struct Dog {
154-
var name = "Generic dog name"
155-
var age = 0
156-
157-
// The synthesized memberwise initializer
158-
init(name: String = "Generic dog name", age: Int = 0)
159-
}
160-
161-
let sparky = Dog(name: "Sparky") // Dog(name: "Sparky", age: 0)
162-
```
163-
16428
* [SE-0068][]:
16529

166-
It is now possible to use `Self` to refer to the innermost nominal
167-
type inside struct, enum and class declarations. For example, the
168-
two method declarations inside this struct are equivalent:
169-
170-
```swift
171-
struct Box<Value> {
172-
func transform1() -> Self { return self }
173-
func transform2() -> Box<Value> { return self }
174-
}
175-
```
176-
177-
In classes, `Self` is the dynamic type of the `self` value, as before.
178-
Existing restrictions on `Self` in declaration types still apply;
179-
that is, `Self` can only appear as the return type of a method.
180-
However, `Self` can now be used inside the body of a method
181-
without limitation.
30+
`Self` can now be used inside member functions and for function arguments of structs and enums to refer to the containing type.
18231

18332
* [SR-7799][]:
18433

@@ -197,12 +46,12 @@ Swift 5.1
19746
}
19847
```
19948

200-
* `weak` and `unowned` stored properties no longer inhibit the
201-
automatic synthesis of `Equatable` or `Hashable` conformance.
49+
* `weak` and `unowned` variables can now be used inside types that
50+
declare `Equatable` or `Hashable` conformance.
20251

20352
* [SR-2688][]:
20453

205-
An `@autoclosure` parameter can now be declared with a typealias type.
54+
An `@autoclosure` closure can now be a typealias.
20655

20756
```swift
20857
class Foo {
@@ -213,12 +62,10 @@ Swift 5.1
21362

21463
* [SR-7601][]:
21564

216-
Methods declared `@objc` inside a class can now return `Self`:
65+
Functions marked with `@objc` can now return `Self`
21766

21867
```swift
219-
class MyClass : NSObject {
220-
@objc func clone() -> Self { return self }
221-
}
68+
@objc func returnDynamicSelf() -> Self { return self }
22269
```
22370

22471
* [SR-2176][]:
@@ -262,8 +109,6 @@ Swift 5.1
262109
Swift 5.0
263110
---------
264111

265-
### 2019-03-25 (Xcode 10.2)
266-
267112
* [SE-0235][]:
268113

269114
The standard library now contains a `Result` type for manually propagating errors.
@@ -524,6 +369,8 @@ Swift 5.0
524369
}
525370
```
526371

372+
**Add new entries to the top of this section, not here!**
373+
527374
Swift 4.2
528375
---------
529376

@@ -7664,11 +7511,7 @@ Swift 1.0
76647511
[SE-0228]: <https://github.com/apple/swift-evolution/blob/master/proposals/0228-fix-expressiblebystringinterpolation.md>
76657512
[SE-0230]: <https://github.com/apple/swift-evolution/blob/master/proposals/0230-flatten-optional-try.md>
76667513
[SE-0235]: <https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md>
7667-
[SE-0242]: <https://github.com/apple/swift-evolution/blob/master/proposals/0242-default-values-memberwise.md>
7668-
[SE-0244]: <https://github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md>
76697514
[SE-0245]: <https://github.com/apple/swift-evolution/blob/master/proposals/0245-array-uninitialized-initializer.md>
7670-
[SE-0252]: <https://github.com/apple/swift-evolution/blob/master/proposals/0252-keypath-dynamic-member-lookup.md>
7671-
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
76727515

76737516
[SR-106]: <https://bugs.swift.org/browse/SR-106>
76747517
[SR-419]: <https://bugs.swift.org/browse/SR-419>
@@ -7682,16 +7525,12 @@ Swift 1.0
76827525
[SR-2388]: <https://bugs.swift.org/browse/SR-2388>
76837526
[SR-2394]: <https://bugs.swift.org/browse/SR-2394>
76847527
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
7685-
[SR-2672]: <https://bugs.swift.org/browse/SR-2672>
76867528
[SR-2688]: <https://bugs.swift.org/browse/SR-2688>
76877529
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
76887530
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
76897531
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>
7690-
[SR-6118]: <https://bugs.swift.org/browse/SR-6118>
76917532
[SR-7139]: <https://bugs.swift.org/browse/SR-7139>
76927533
[SR-7251]: <https://bugs.swift.org/browse/SR-7251>
76937534
[SR-7601]: <https://bugs.swift.org/browse/SR-7601>
76947535
[SR-7799]: <https://bugs.swift.org/browse/SR-7799>
76957536
[SR-8109]: <https://bugs.swift.org/browse/SR-8109>
7696-
[SR-8546]: <https://bugs.swift.org/browse/SR-8546>
7697-
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>

branches/master-next/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ else()
497497
swift_common_unified_build_config(SWIFT)
498498
endif()
499499

500-
get_filename_component(SWIFT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
500+
set(SWIFT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
501501
set(SWIFT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
502502
set(SWIFT_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
503503
set(SWIFT_MAIN_INCLUDE_DIR "${SWIFT_SOURCE_DIR}/include")

branches/master-next/benchmark/CMakeLists.txt

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,6 @@ set(BENCHOPTS_MULTITHREADED
253253
"-whole-module-optimization" "-num-threads" "4")
254254
set(BENCHOPTS_SINGLEFILE "")
255255

256-
option(SWIFT_BENCHMARK_USE_OS_LIBRARIES
257-
"Runtime link against the Swift libraries on the target (/usr/lib/swift)."
258-
FALSE)
259-
260256
configure_build()
261257

262258
#===-----------------------------------------------------------------------===#
@@ -272,18 +268,10 @@ configure_sdks()
272268
message("--")
273269
message("-- Swift Benchmark Suite:")
274270
message("-- SWIFT_BENCHMARK_BUILT_STANDALONE = ${SWIFT_BENCHMARK_BUILT_STANDALONE}")
275-
message("-- SWIFT_BENCHMARK_USE_OS_LIBRARIES = ${SWIFT_BENCHMARK_USE_OS_LIBRARIES}")
276-
message("-- SWIFT_EXEC = ${SWIFT_EXEC}")
277-
message("-- SWIFT_LIBRARY_PATH = ${SWIFT_LIBRARY_PATH}")
278-
if (SWIFT_RPATH_BASE)
279-
message("-- SWIFT_RPATH_BASE = ${SWIFT_RPATH_BASE}")
280-
endif()
281-
if (SWIFT_RPATH)
282-
message("-- SWIFT_RPATH = ${SWIFT_RPATH}")
283-
message("--- ** WARNING ** Benchmarking against Swift-in-the-OS")
284-
endif()
285-
message("-- CLANG_EXEC = ${CLANG_EXEC}")
271+
message("-- SWIFT_EXEC = ${SWIFT_EXEC}")
286272
message("-- SWIFT_BENCHMARK_EXTRA_FLAGS = ${SWIFT_BENCHMARK_EXTRA_FLAGS}")
273+
message("-- SWIFT_LIBRARY_PATH = ${SWIFT_LIBRARY_PATH}")
274+
message("-- CLANG_EXEC = ${CLANG_EXEC}")
287275
message("-- SWIFT_OPTIMIZATION_LEVELS = ${SWIFT_OPTIMIZATION_LEVELS}")
288276
message("-- ONLY_PLATFORMS = ${ONLY_PLATFORMS}")
289277
message("-- PAGE_ALIGNMENT_OPTION = ${PAGE_ALIGNMENT_OPTION}")

branches/master-next/benchmark/README.md

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ flags:
2828
OS X benchmark driver binaries are placed in `bin` alongside `swiftc`.
2929
Additional platform binaries are placed in the `benchmark/bin` build directory.
3030

31-
The required Swift standard library dylibs are placed in `lib`. The
32-
drivers dynamically link Swift standard library dylibs from a path
33-
relative to their run-time location (../lib/swift) so the standard
34-
library should be distributed alongside them.
35-
3631
Building Independently
3732
----------------------
3833

@@ -48,19 +43,15 @@ The following build options are available:
4843
* `-DSWIFT_LIBRARY_PATH`
4944
* An absolute path to the Swift standard library to use during compilation
5045
(default: `swiftc_directory`/../lib/swift)
51-
* `-DSWIFT_DARWIN_XCRUN_TOOLCHAIN`
52-
* The Xcode toolchain to use when invoking `xcrun` to find `clang`.
53-
(default: XcodeDefault)
5446
* `-DONLY_PLATFORMS`
5547
* A list of platforms to build the benchmarks for
5648
(default: "macosx;iphoneos;appletvos;watchos")
5749
* `-DSWIFT_OPTIMIZATION_LEVELS`
5850
* A list of Swift optimization levels to build against
5951
(default: "O;Onone;Osize")
60-
* `-DSWIFT_BENCHMARK_USE_OS_LIBRARIES`
61-
* Enable this option to link the benchmark binaries against the target
62-
machine's Swift standard library and runtime installed with the OS.
63-
(default: OFF)
52+
* `-DSWIFT_BENCHMARK_EMIT_SIB`
53+
* A boolean value indicating whether .sib files should be generated
54+
alongside .o files (default: FALSE)
6455

6556
The following build targets are available:
6657

@@ -75,40 +66,13 @@ Build steps (with example options):
7566
1. `$ cd benchmark`
7667
2. `$ mkdir build`
7768
3. `$ cd build`
78-
4. `$ cmake ../benchmark -G Ninja -DSWIFT_EXEC=[path to built swiftc]`
79-
5. `$ ninja swift-benchmark-macosx-x86_64`
80-
81-
Benchmark binaries are placed in `bin`.
82-
83-
The binaries dynamically link Swift standard library dylibs from a
84-
path determined by the configuration. If `SWIFT_LIBRARY_PATH` is set,
85-
they link against the absolute path provided, regardless of where the
86-
binaries are installed. Otherwise, the runtime library path is
87-
relative to the benchmark binary at the time it was executed
88-
(`@executable_path/../lib/swift/<platform>`).
89-
90-
For example, to benchmark against a locally built `swiftc`, including
91-
any standard library changes in that build, you might configure using:
92-
93-
cmake ../benchmark -G Ninja -DSWIFT_EXEC=<src>/swift/build/swift-macosx-x86_64/bin/swiftc
94-
ninja swift-benchmark-iphoneos-arm64
95-
96-
To build against the installed Xcode, simply omit SWIFT_EXEC:
97-
98-
cmake ../benchmark -G Ninja
99-
ninja swift-benchmark-iphoneos-arm64
100-
101-
In both examples above, to run the benchmarks on a device, the dynamic
102-
libraries must then be copied onto the device into the library path
103-
relative to `swiftc`. To benchmark against the target machine's
104-
installed libraries instead, enable
105-
`SWIFT_BENCHMARK_USE_OS_LIBRARIES`.
106-
107-
cmake ../benchmark -G Ninja -DSWIFT_BENCHMARK_USE_OS_LIBRARIES=ON
108-
ninja swift-benchmark-iphoneos-arm64
69+
4. `$ cmake ..`
70+
5. `$ make -j8 swift-benchmark-macosx-x86_64`
10971

110-
This will reflect the performance of the Swift standard library
111-
installed on the device, not the one included in the Swift root.
72+
Benchmark driver binaries are placed in `build/bin` and the required Swift
73+
standard library dylibs are placed in `build/lib`. The drivers dynamically link
74+
Swift standard library dylibs from a path relative to their location
75+
(../lib/swift) so the standard library should be distributed alongside them.
11276

11377
Using the Benchmark Driver
11478
--------------------------

0 commit comments

Comments
 (0)