Skip to content

Commit a816d25

Browse files
committed
merge master
2 parents f3dcdc2 + d84bab0 commit a816d25

File tree

963 files changed

+32539
-27090
lines changed

Some content is hidden

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

963 files changed

+32539
-27090
lines changed

CHANGELOG.md

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

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

2526
</details>
2627

28+
Swift Next
29+
----------
30+
31+
* [SE-0287][]:
32+
33+
Implicit member expressions now support chains of member accesses, making the following valid:
34+
35+
```swift
36+
let milky: UIColor = .white.withAlphaComponent(0.5)
37+
let milky2: UIColor = .init(named: "white")!.withAlphaComponent(0.5)
38+
let milkyChance: UIColor? = .init(named: "white")?.withAlphaComponent(0.5)
39+
```
40+
41+
As is the case with the existing implicit member expression syntax, the resulting type of the chain must be the same as the (implicit) base, so it is not well-formed to write:
42+
43+
```swift
44+
let cgMilky: CGColor = .white.withAlphaComponent(0.5).cgColor
45+
```
46+
47+
(Unless, of course, appropriate `white` and `withAlphaComponent` members were defined on `CGColor`.)
48+
49+
Members of a "chain" can be properties, method calls, subscript accesses, force unwraps, or optional chaining question marks. Furthermore, the type of each member along the chain is permitted to differ (again, as long as the base of the chain matches the resulting type) meaning the following successfully typechecks:
50+
51+
```swift
52+
struct Foo {
53+
static var foo = Foo()
54+
static var bar = Bar()
55+
56+
var anotherFoo: Foo { Foo() }
57+
func getFoo() -> Foo { Foo() }
58+
var optionalFoo: Foo? { Foo() }
59+
subscript() -> Foo { Foo() }
60+
}
61+
62+
struct Bar {
63+
var anotherFoo = Foo()
64+
}
65+
66+
let _: Foo? = .bar.anotherFoo.getFoo().optionalFoo?.optionalFoo![]
67+
```
68+
2769
Swift 5.3
2870
---------
2971

72+
* [SE-0279][] & [SE-0286][]:
73+
74+
Trailing closure syntax has been extended to allow additional labeled closures to follow the initial unlabeled closure:
75+
76+
```swift
77+
// Single trailing closure argument
78+
UIView.animate(withDuration: 0.3) {
79+
self.view.alpha = 0
80+
}
81+
// Multiple trailing closure arguments
82+
UIView.animate(withDuration: 0.3) {
83+
self.view.alpha = 0
84+
} completion: { _ in
85+
self.view.removeFromSuperview()
86+
}
87+
```
88+
89+
Additionally, trailing closure arguments now match the appropriate parameter according to a forward-scan rule (as opposed to the previous backward-scan rule):
90+
91+
```swift
92+
func takesClosures(first: () -> Void, second: (Int) -> Void = { _ in }) {}
93+
94+
takesClosures {
95+
print("First")
96+
}
97+
```
98+
99+
In the above example, the trailing closure argument matches parameter `first`, whereas pre-Swift-5.3 it would have matched `second`. In order to ease the transition to this new rule, cases in which the forward-scan and backward-scan match a single trailing closure to different parameters, the backward-scan result is preferred and a warning is emitted. This is expected to be upgraded to an error in the next major version of Swift.
100+
30101
* [SR-7083][]:
31102

32103
Property observers such as `willSet` and `didSet` are now supported on `lazy` properties:
@@ -8070,7 +8141,10 @@ Swift 1.0
80708141
[SE-0268]: <https://github.com/apple/swift-evolution/blob/master/proposals/0268-didset-semantics.md>
80718142
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
80728143
[SE-0276]: <https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md>
8144+
[SE-0279]: <https://github.com/apple/swift-evolution/blob/master/proposals/0279-multiple-trailing-closures.md>
80738145
[SE-0280]: <https://github.com/apple/swift-evolution/blob/master/proposals/0280-enum-cases-as-protocol-witnesses.md>
8146+
[SE-0286]: <https://github.com/apple/swift-evolution/blob/master/proposals/0286-forward-scan-trailing-closures.md>
8147+
[SE-0287]: <https://github.com/apple/swift-evolution/blob/master/proposals/0287-implicit-member-chains.md>
80748148

80758149
[SR-75]: <https://bugs.swift.org/browse/SR-75>
80768150
[SR-106]: <https://bugs.swift.org/browse/SR-106>

CMakeLists.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ option(SWIFT_REPORT_STATISTICS
369369
"Create json files which contain internal compilation statistics"
370370
FALSE)
371371

372+
option(SWIFT_DISABLE_OBJC_INTEROP
373+
"Disable Objective-C interoperability even on platforms what would normally have it"
374+
FALSE)
375+
372376
#
373377
# User-configurable experimental options. Do not use in production builds.
374378
#
@@ -386,10 +390,6 @@ option(SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
386390
"Should the runtime be built with support for non-thread-safe leak detecting entrypoints"
387391
FALSE)
388392

389-
option(SWIFT_STDLIB_USE_NONATOMIC_RC
390-
"Build the standard libraries and overlays with nonatomic reference count operations enabled"
391-
FALSE)
392-
393393
option(SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS
394394
"Enable runtime function counters and expose the API."
395395
FALSE)
@@ -629,6 +629,22 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQU
629629
set(SWIFT_COMPILER_IS_MSVC_LIKE TRUE)
630630
endif()
631631

632+
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
633+
# CMake's default for CMAKE_CXX_FLAGS_RELEASE is "-O3 -DNDEBUG". Let's avoid "-O3" for consistency
634+
# between Release and RelWithDebInfo. Dropping -DNDEBUG from this setting is blocked by triggering
635+
# a test failure of Swift-Unit :: Syntax/./SwiftSyntaxTests/TypeSyntaxTests.MetatypeTypeWithAPIs
636+
# because unit tests don't currently explicitly set -DNDEBUG/-UNDEBUG.
637+
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
638+
639+
_compute_lto_flag("${SWIFT_TOOLS_ENABLE_LTO}" _lto_flag_out)
640+
if(_lto_flag_out)
641+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} -gline-tables-only")
642+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -gline-tables-only")
643+
endif()
644+
else()
645+
646+
endif()
647+
632648
#
633649
# Configure SDKs.
634650
#
@@ -898,7 +914,6 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
898914
endif()
899915
endif()
900916

901-
find_package(Python2 COMPONENTS Interpreter REQUIRED)
902917
find_package(Python3 COMPONENTS Interpreter REQUIRED)
903918

904919
#

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ The required version of Xcode changes frequently, and is often a beta release.
104104
Check this document or the host information on <https://ci.swift.org> for the
105105
current required version.
106106

107+
Swift's build tooling is meant to support spaces in the paths passed to them,
108+
but using spaces sometimes tickles bugs in Swift's build scripts or the tools
109+
they rely on. For example, [SR-13441](https://bugs.swift.org/browse/SR-13441)
110+
is caused by a space in the Xcode path used on macOS. If you see Swift's build
111+
tooling misbehave due to a space in a path, please
112+
[report the bug on the Swift bug tracker](https://swift.org/contributing/#reporting-bugs)
113+
and then change the path to work around it.
114+
107115
You will also need [CMake](https://cmake.org) and [Ninja](https://ninja-build.org),
108116
which can be installed via a package manager:
109117

benchmark/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ set(SWIFT_BENCH_MODULES
9191
single-source/Fibonacci
9292
single-source/FindStringNaive
9393
single-source/FlattenList
94+
single-source/FloatingPointConversion
9495
single-source/FloatingPointParsing
9596
single-source/FloatingPointPrinting
9697
single-source/Hanoi
@@ -136,6 +137,7 @@ set(SWIFT_BENCH_MODULES
136137
single-source/PrefixWhile
137138
single-source/Prims
138139
single-source/PrimsNonStrongRef
140+
single-source/ProtocolConformance
139141
single-source/ProtocolDispatch
140142
single-source/ProtocolDispatch2
141143
single-source/Queue

benchmark/scripts/Template.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2020 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -19,4 +19,4 @@ public let {name} = [
1919
@inline(never)
2020
public func run_{name}(N: Int) {{
2121
// TODO
22-
}}
22+
}}

0 commit comments

Comments
 (0)