Skip to content

Commit 7269b02

Browse files
authored
Merge pull request #31451 from apple/tensorflow-merge
Merge 2020-04-29 into tensorflow
2 parents ec43152 + 9a41c42 commit 7269b02

File tree

1,200 files changed

+27771
-15762
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,200 files changed

+27771
-15762
lines changed

CHANGELOG.md

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,75 @@ CHANGELOG
2525
</details>
2626

2727
Swift 5.3
28-
----------
28+
---------
29+
30+
* [SR-7083][]:
31+
32+
Property observers such as `willSet` and `didSet` are now supported on `lazy` properties:
33+
34+
```swift
35+
class C {
36+
lazy var property: Int = 0 {
37+
willSet { print("willSet called!") } // Okay
38+
didSet { print("didSet called!") } // Okay
39+
}
40+
}
41+
```
42+
43+
Note that the initial value of the property will be forced and made available as the `oldValue` for the `didSet` observer, if the property hasn't been accessed yet.
44+
45+
```swift
46+
class C {
47+
lazy var property: Int = 0 {
48+
didSet { print("Old value: ", oldValue) }
49+
}
50+
}
51+
52+
let c = C()
53+
c.property = 1 // Prints 'Old value: 0'
54+
```
55+
56+
This could have side-effects, for example if the lazy property's initializer is doing other work.
57+
58+
* [SR-11700][]:
59+
60+
Exclusivity violations within code that computes the `default`
61+
argument during Dictionary access are now diagnosed.
62+
63+
```swift
64+
struct Container {
65+
static let defaultKey = 0
66+
67+
var dictionary = [defaultKey:0]
68+
69+
mutating func incrementValue(at key: Int) {
70+
dictionary[key, default: dictionary[Container.defaultKey]!] += 1
71+
}
72+
}
73+
// error: overlapping accesses to 'self.dictionary', but modification requires exclusive access; consider copying to a local variable
74+
// dictionary[key, default: dictionary[Container.defaultKey]!] += 1
75+
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76+
// note: conflicting access is here
77+
// dictionary[key, default: dictionary[Container.defaultKey]!] += 1
78+
// ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
79+
```
80+
81+
The exclusivity violation can be avoided by precomputing the `default`
82+
argument using a local variable.
83+
84+
```swift
85+
struct Container {
86+
static let defaultKey = 0
87+
88+
var dictionary = [defaultKey:0]
89+
90+
mutating func incrementValue(at key: Int) {
91+
let defaultValue = dictionary[Container.defaultKey]!
92+
dictionary[key, default: defaultValue] += 1
93+
}
94+
}
95+
// No error.
96+
```
2997

3098
* [SE-0268][]:
3199

@@ -585,8 +653,6 @@ Swift 5.1
585653
`Array` and `ContiguousArray` now have `init(unsafeUninitializedCapacity:initializingWith:)`,
586654
which provides access to the array's uninitialized storage.
587655

588-
**Add new entries to the top of this section, not here!**
589-
590656
Swift 5.0
591657
---------
592658

@@ -8028,6 +8094,7 @@ Swift 1.0
80288094
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
80298095
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>
80308096
[SR-6118]: <https://bugs.swift.org/browse/SR-6118>
8097+
[SR-7083]: <https://bugs.swift.org/browse/SR-7083>
80318098
[SR-7139]: <https://bugs.swift.org/browse/SR-7139>
80328099
[SR-7251]: <https://bugs.swift.org/browse/SR-7251>
80338100
[SR-7601]: <https://bugs.swift.org/browse/SR-7601>
@@ -8039,4 +8106,5 @@ Swift 1.0
80398106
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
80408107
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
80418108
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>
8109+
[SR-11700]: <https://bugs.swift.org/browse/SR-11700>
80428110
[SR-11841]: <https://bugs.swift.org/browse/SR-11841>

CMakeLists.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,13 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
910910
endif()
911911

912912
find_package(Python2 COMPONENTS Interpreter REQUIRED)
913-
find_package(Python3 COMPONENTS Interpreter REQUIRED)
913+
find_package(Python3 COMPONENTS Interpreter)
914+
if(NOT Python3_Interpreter_FOUND)
915+
message(WARNING "Python3 not found, using python2 as a fallback")
916+
add_executable(Python3::Interpreter IMPORTED)
917+
set_target_properties(Python3::Interpreter PROPERTIES
918+
IMPORTED_LOCATION ${Python2_EXECUTABLE})
919+
endif()
914920

915921
#
916922
# Find optional dependencies.
@@ -1056,11 +1062,13 @@ if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
10561062
set(SOURCEKIT_RUNTIME_DIR lib)
10571063
endif()
10581064
add_dependencies(sourcekit-inproc BlocksRuntime dispatch)
1059-
swift_install_in_component(FILES
1060-
$<TARGET_FILE:dispatch>
1061-
$<TARGET_FILE:BlocksRuntime>
1062-
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1063-
COMPONENT sourcekit-inproc)
1065+
if("${SWIFT_HOST_VARIANT_SDK}" MATCHES "OSX|WINDOWS")
1066+
swift_install_in_component(FILES
1067+
$<TARGET_FILE:dispatch>
1068+
$<TARGET_FILE:BlocksRuntime>
1069+
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1070+
COMPONENT sourcekit-inproc)
1071+
endif()
10641072
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
10651073
swift_install_in_component(FILES
10661074
$<TARGET_LINKER_FILE:dispatch>

benchmark/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ set(SWIFT_BENCH_MODULES
9696
single-source/Hanoi
9797
single-source/Hash
9898
single-source/Histogram
99-
single-source/InsertCharacter
99+
single-source/HTTP2StateMachine
100+
single-source/InsertCharacter
100101
single-source/IntegerParsing
101102
single-source/Integrate
102103
single-source/IterateData

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)