Skip to content

Commit fc382d2

Browse files
committed
Merge branch 'master' into add-equatable-conformance
2 parents ad15f21 + 843a584 commit fc382d2

File tree

2,993 files changed

+429187
-322468
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,993 files changed

+429187
-322468
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#==============================================================================#
2323
# Explicit files to ignore (only matches one).
2424
#==============================================================================#
25+
Brewfile.lock.json
2526
cscope.files
2627
cscope.out
2728
.vimrc

Brewfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brew "cmake"
2+
brew "ninja"

CHANGELOG.md

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

77
| Version | Released | Toolchain |
88
| :--------------------- | :--------- | :---------- |
9-
| [Swift 5.2](#swift-52) | | |
9+
| [Swift 5.3](#swift-53) | | |
10+
| [Swift 5.2](#swift-52) | 2020-03-24 | Xcode 11.4 |
1011
| [Swift 5.1](#swift-51) | 2019-09-20 | Xcode 11.0 |
1112
| [Swift 5.0](#swift-50) | 2019-03-25 | Xcode 10.2 |
1213
| [Swift 4.2](#swift-42) | 2018-09-17 | Xcode 10.0 |
@@ -23,9 +24,92 @@ CHANGELOG
2324

2425
</details>
2526

26-
Swift Next
27+
Swift 5.3
2728
----------
2829

30+
* [SE-0268][]:
31+
32+
A `didSet` observer which does not refer to the `oldValue` in its body or does not explicitly request it by placing it in the parameter list (i.e. `didSet(oldValue)`) will no longer trigger a call to the property getter to fetch the `oldValue`.
33+
34+
```swift
35+
class C {
36+
var value: Int = 0 {
37+
didSet { print("didSet called!") }
38+
}
39+
}
40+
41+
let c = C()
42+
// This does not trigger a call to the getter for 'value'
43+
// because the 'didSet' observer on 'value' does not
44+
// refer to the 'oldValue' in its body, which means
45+
// the 'oldValue' does not need to be fetched.
46+
c.value = 1
47+
```
48+
49+
* [SE-0276][]:
50+
51+
Catch clauses in a `do`-`catch` statement can now include multiple patterns in a comma-separated list. The body of a `catch` clause will be executed if a thrown error matches any of its patterns.
52+
53+
```swift
54+
do {
55+
try performTask()
56+
} catch TaskError.someFailure(let msg),
57+
TaskError.anotherFailure(let msg) {
58+
showMessage(msg)
59+
}
60+
```
61+
62+
* [SE-0280][]:
63+
64+
Enum cases can now satisfy static protocol requirements. A static get-only property of type `Self` can be witnessed by an enum case with no associated values and a static function with arguments and returning `Self` can be witnessed by an enum case with associated values.
65+
66+
```swift
67+
protocol P {
68+
static var foo: Self { get }
69+
static func bar(value: Int) -> Self
70+
}
71+
72+
enum E: P {
73+
case foo // matches 'static var foo'
74+
case bar(value: Int) // matches 'static func bar(value:)'
75+
}
76+
```
77+
78+
* [SE-0267][]:
79+
80+
Non-generic members that support a generic parameter list, including nested type declarations, are now allowed to carry a contextual `where` clause against outer generic parameters. Previously, such declarations could only be expressed by placing the member inside a dedicated constrained extension.
81+
82+
```swift
83+
struct Box<Wrapped> {
84+
func boxes() -> [Box<Wrapped.Element>] where Wrapped: Sequence { ... }
85+
}
86+
```
87+
Since contextual `where` clauses are effectively visibility constraints, overrides adopting this feature must be at least as visible as the overridden method. In practice, this implies any instance of `Derived` that can access `Base.foo` must also be able to access `Derived.foo`.
88+
89+
```swift
90+
class Base<T> {
91+
func foo() where T == Int { ... }
92+
}
93+
94+
class Derived<U>: Base<U> {
95+
// OK, <U where U: Equatable> has broader visibility than <T where T == Int>
96+
override func foo() where U: Equatable { ... }
97+
}
98+
99+
* [SR-75][]:
100+
101+
Unapplied references to protocol methods are now supported. Previously this
102+
only worked for methods defined in structs, enums and classes.
103+
104+
```swift
105+
protocol Cat {
106+
func play(catToy: Toy)
107+
}
108+
109+
let fn = Cat.play(catToy:)
110+
fn(myCat)(myToy)
111+
```
112+
29113
* [SE-0266][]:
30114

31115
Enumerations with no associated values, or only `Comparable` associated values, can opt-in to synthesized `Comparable` conformance by declaring conformance to the `Comparable` protocol. The synthesized implementation orders the cases first by case-declaration order, and then by lexicographic order of the associated values (if any).
@@ -62,9 +146,13 @@ Swift Next
62146
closure's capture list in addition to the existing 'use `self.` explicitly'
63147
fix-it.
64148

149+
**Add new entries to the top of this section, not here!**
150+
65151
Swift 5.2
66152
---------
67153

154+
### 2020-03-24 (Xcode 11.4)
155+
68156
* [SR-11841][]:
69157

70158
When chaining calls to `filter(_:)` on a lazy sequence or collection, the
@@ -257,8 +345,6 @@ Swift 5.2
257345
print(s[0])
258346
```
259347

260-
**Add new entries to the top of this section, not here!**
261-
262348
Swift 5.1
263349
---------
264350

@@ -7914,8 +8000,13 @@ Swift 1.0
79148000
[SE-0253]: <https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
79158001
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
79168002
[SE-0266]: <https://github.com/apple/swift-evolution/blob/master/proposals/0266-synthesized-comparable-for-enumerations.md>
8003+
[SE-0267]: <https://github.com/apple/swift-evolution/blob/master/proposals/0267-where-on-contextually-generic.md>
8004+
[SE-0268]: <https://github.com/apple/swift-evolution/blob/master/proposals/0268-didset-semantics.md>
79178005
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
8006+
[SE-0276]: <https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md>
8007+
[SE-0280]: <https://github.com/apple/swift-evolution/blob/master/proposals/0280-enum-cases-as-protocol-witnesses.md>
79188008

8009+
[SR-75]: <https://bugs.swift.org/browse/SR-75>
79198010
[SR-106]: <https://bugs.swift.org/browse/SR-106>
79208011
[SR-419]: <https://bugs.swift.org/browse/SR-419>
79218012
[SR-631]: <https://bugs.swift.org/browse/SR-631>

CMakeLists.txt

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.4.3)
1+
cmake_minimum_required(VERSION 3.12.4)
22

33
# TODO: Fix RPATH usage to be CMP0068 compliant
44
# Disable Policy CMP0068 for CMake 3.9
@@ -137,7 +137,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
137137
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
138138
# can be reused when a new version of Swift comes out (assuming the user hasn't
139139
# manually set it as part of their own CMake configuration).
140-
set(SWIFT_VERSION "5.2")
140+
set(SWIFT_VERSION "5.3")
141141

142142
set(SWIFT_VENDOR "" CACHE STRING
143143
"The vendor name of the Swift compiler")
@@ -477,7 +477,6 @@ endif()
477477
include(SwiftComponents)
478478
include(SwiftHandleGybSources)
479479
include(SwiftSetIfArchBitness)
480-
include(SwiftSource)
481480
include(AddSwift)
482481
include(SwiftConfigureSDK)
483482
include(SwiftComponents)
@@ -571,6 +570,8 @@ else()
571570
set(SWIFT_HOST_VARIANT_SDK_default "LINUX")
572571
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
573572
set(SWIFT_HOST_VARIANT_SDK_default "FREEBSD")
573+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
574+
set(SWIFT_HOST_VARIANT_SDK_default "OPENBSD")
574575
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
575576
set(SWIFT_HOST_VARIANT_SDK_default "CYGWIN")
576577
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
@@ -674,6 +675,15 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "FREEBSD")
674675
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
675676
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
676677

678+
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "OPENBSD")
679+
680+
set(SWIFT_HOST_VARIANT "openbsd" CACHE STRING
681+
"Deployment OS for Swift host tools (the compiler) [openbsd].")
682+
683+
configure_sdk_unix("OpenBSD" "${SWIFT_HOST_VARIANT_ARCH}")
684+
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
685+
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
686+
677687
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "CYGWIN")
678688

679689
set(SWIFT_HOST_VARIANT "cygwin" CACHE STRING
@@ -882,7 +892,14 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
882892
endif()
883893
endif()
884894

885-
find_package(PythonInterp REQUIRED)
895+
find_package(Python2 COMPONENTS Interpreter REQUIRED)
896+
find_package(Python3 COMPONENTS Interpreter)
897+
if(NOT Python3_Interpreter_FOUND)
898+
message(WARNING "Python3 not found, using python2 as a fallback")
899+
add_executable(Python3::Interpreter IMPORTED)
900+
set_target_properties(Python3::Interpreter PROPERTIES
901+
IMPORTED_LOCATION ${Python2_EXECUTABLE})
902+
endif()
886903

887904
#
888905
# Find optional dependencies.
@@ -1028,11 +1045,13 @@ if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
10281045
set(SOURCEKIT_RUNTIME_DIR lib)
10291046
endif()
10301047
add_dependencies(sourcekit-inproc BlocksRuntime dispatch)
1031-
swift_install_in_component(FILES
1032-
$<TARGET_FILE:dispatch>
1033-
$<TARGET_FILE:BlocksRuntime>
1034-
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1035-
COMPONENT sourcekit-inproc)
1048+
if("${SWIFT_HOST_VARIANT_SDK}" MATCHES "OSX|WINDOWS")
1049+
swift_install_in_component(FILES
1050+
$<TARGET_FILE:dispatch>
1051+
$<TARGET_FILE:BlocksRuntime>
1052+
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1053+
COMPONENT sourcekit-inproc)
1054+
endif()
10361055
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
10371056
swift_install_in_component(FILES
10381057
$<TARGET_LINKER_FILE:dispatch>

README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
2020
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|
2121
|**[Windows 2019 (VS 2017)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64)|
22-
|**[Windows 2019 (VS 2019)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019_VS2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/ooss-swift-windows-x86_64-vs2019)|
22+
|**[Windows 2019 (VS 2019)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019_VS2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019)|
2323

2424
**Swift TensorFlow Community-Hosted CI Platforms**
2525

@@ -78,6 +78,9 @@ source code and up to 70 GB of disk space for the build artifacts with full
7878
debugging. Depending on your machine, a clean build can take a few minutes to
7979
several hours. Naturally, incremental builds are much faster.
8080

81+
Once you are able to build things successfully and have a compile-test-debug
82+
loop going, check out the [development tips](docs/DevelopmentTips.md) for
83+
better productivity while working on the compiler.
8184

8285
### System Requirements
8386

@@ -88,7 +91,7 @@ Please make sure you use Python 2.x. Python 3.x is not supported currently.
8891

8992
#### macOS
9093

91-
To build for macOS, you need [Xcode 11.3](https://developer.apple.com/xcode/downloads/).
94+
To build for macOS, you need [Xcode 11.4](https://developer.apple.com/xcode/resources/).
9295
The required version of Xcode changes frequently, and is often a beta release.
9396
Check this document or the host information on <https://ci.swift.org> for the
9497
current required version.
@@ -99,6 +102,12 @@ which can be installed via a package manager:
99102
**[Homebrew](https://brew.sh/)**
100103

101104
brew install cmake ninja
105+
106+
You can also use [homebrew-bundle](https://github.com/Homebrew/homebrew-bundle)
107+
from the root of this repository's working directory to install all of these
108+
dependencies:
109+
110+
brew bundle
102111

103112
**[MacPorts](https://macports.org)**
104113

@@ -110,9 +119,29 @@ Instructions for installing CMake and Ninja directly can be found [below](#build
110119

111120
For Ubuntu, you'll need the following development dependencies:
112121

113-
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libedit-dev \
114-
libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libcurl4-openssl-dev \
115-
systemtap-sdt-dev tzdata rsync python-six
122+
```
123+
sudo apt-get install \
124+
clang \
125+
cmake \
126+
git \
127+
icu-devtools \
128+
libcurl4-openssl-dev \
129+
libedit-dev \
130+
libicu-dev \
131+
libncurses5-dev \
132+
libpython-dev \
133+
libsqlite3-dev \
134+
libxml2-dev \
135+
ninja-build \
136+
pkg-config \
137+
python \
138+
python-six \
139+
rsync \
140+
swig \
141+
systemtap-sdt-dev \
142+
tzdata \
143+
uuid-dev
144+
```
116145

117146
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
118147
with version 2 shipped with Ubuntu.
@@ -129,7 +158,9 @@ First create a directory for all of the Swift sources:
129158
**Note:** This is important since update-checkout (see below) checks out
130159
repositories next to the Swift source directory. This means that if one clones
131160
Swift and has other unrelated repositories, update-checkout may not clone those
132-
repositories and will update them instead.
161+
repositories and will update them instead. Be aware that `update-checkout`
162+
currently does not support paths with non-ASCII characters. If such characters
163+
are present in the path to `swift-source`, `update-checkout` will fail.
133164

134165
**Via HTTPS** For those checking out sources as read-only, HTTPS works best:
135166

@@ -336,7 +367,7 @@ expressed today.
336367

337368
### CMake
338369
[CMake](https://cmake.org) is the core infrastructure used to configure builds of
339-
Swift and its companion projects; at least version 3.4.3 is required.
370+
Swift and its companion projects; at least version 3.16.5 is required.
340371

341372
On macOS, you can download the [CMake Binary Distribution](https://cmake.org/download),
342373
bundled as an application, copy it to `/Applications`, and add the embedded

benchmark/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ set(SWIFT_BENCH_MODULES
6262
single-source/Combos
6363
single-source/DataBenchmarks
6464
single-source/DeadArray
65+
single-source/DevirtualizeProtocolComposition
6566
single-source/DictOfArraysToArrayOfDicts
6667
single-source/DictTest
6768
single-source/DictTest2
@@ -95,8 +96,7 @@ set(SWIFT_BENCH_MODULES
9596
single-source/Hanoi
9697
single-source/Hash
9798
single-source/Histogram
98-
single-source/InsertCharacter
99-
single-source/IntegerParsing
99+
single-source/HTTP2StateMachine
100100
single-source/Integrate
101101
single-source/IterateData
102102
single-source/Join
@@ -140,6 +140,7 @@ set(SWIFT_BENCH_MODULES
140140
single-source/RGBHistogram
141141
single-source/Radix2CooleyTukey
142142
single-source/RandomShuffle
143+
single-source/RandomTree
143144
single-source/RandomValues
144145
single-source/RangeAssignment
145146
single-source/RangeIteration
@@ -225,6 +226,9 @@ endif()
225226
set(SWIFT_BENCHMARK_EXTRA_FLAGS "" CACHE STRING
226227
"Extra options to pass to swiftc when building the benchmarks")
227228

229+
set(SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER NO CACHE BOOL
230+
"Build the benchmark driver utilites without optimization (default: no)")
231+
228232
if (SWIFT_BENCHMARK_BUILT_STANDALONE)
229233
# This option's value must match the value of the same option used when
230234
# building the swift runtime.

benchmark/Package.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ func getSingleSourceLibraries(subDirectory: String) -> [String] {
2222
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
2323
includingPropertiesForKeys: nil)
2424
return fileURLs.compactMap { (path: URL) -> String? in
25-
let c = path.lastPathComponent.split(separator: ".")
26-
// Too many components. Must be a gyb file.
27-
if c.count > 2 {
28-
return nil
29-
}
30-
if c[1] != "swift" {
25+
guard let lastDot = path.lastPathComponent.lastIndex(of: ".") else {
3126
return nil
3227
}
28+
let ext = String(path.lastPathComponent.suffix(from: lastDot))
29+
guard ext == ".swift" else { return nil }
30+
31+
let name = String(path.lastPathComponent.prefix(upTo: lastDot))
3332

34-
let name = String(c[0])
33+
// Test names must have a single component.
34+
if name.contains(".") { return nil }
3535

36-
// We do not support this test.
3736
if unsupportedTests.contains(name) {
37+
// We do not support this test.
3838
return nil
3939
}
4040

0 commit comments

Comments
 (0)