Skip to content

Commit d6cffc9

Browse files
---
yaml --- r: 348793 b: refs/heads/master c: 9e414da h: refs/heads/master i: 348791: e7e3726
1 parent a7a2079 commit d6cffc9

File tree

729 files changed

+18841
-20471
lines changed

Some content is hidden

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

729 files changed

+18841
-20471
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: bb4f46fcc91876a63369f5d3f6ab71364911ceeb
2+
refs/heads/master: 9e414dae18eb072250358975a0700ae6a3fdbb77
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/CHANGELOG.md

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,27 @@ 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.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 |
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) |
2323

2424
</details>
2525

26-
Swift 5.2
27-
---------
28-
29-
* [SR-11429][]:
30-
31-
The compiler will now correctly strip argument labels from function references
32-
used with the `as` operator in a function call. As a result, the `as` operator
33-
can now be used to disambiguate a call to a function with argument labels.
34-
35-
```swift
36-
func foo(x: Int) {}
37-
func foo(x: UInt) {}
38-
39-
(foo as (Int) -> Void)(5) // Calls foo(x: Int)
40-
(foo as (UInt) -> Void)(5) // Calls foo(x: UInt)
41-
```
42-
43-
Previously this was only possible for functions without argument labels.
44-
45-
This change also means that a generic type alias can no longer be used to
46-
preserve the argument labels of a function reference through the `as`
47-
operator. The following is now rejected:
48-
49-
```swift
50-
typealias Magic<T> = T
51-
func foo(x: Int) {}
52-
(foo as Magic)(x: 5) // error: Extraneous argument label 'x:' in call
53-
```
54-
55-
The function value must instead be called without argument labels:
56-
57-
```swift
58-
(foo as Magic)(5)
59-
```
26+
Swift Next
27+
----------
6028

6129
* [SR-11298][]:
6230

@@ -113,7 +81,7 @@ Swift 5.2
11381
mutableSelf.someProperty = newValue // Okay
11482
}
11583
}
116-
```
84+
```
11785

11886
* [SE-0253][]:
11987

@@ -177,8 +145,6 @@ Swift 5.2
177145
Swift 5.1
178146
---------
179147

180-
### 2019-09-20 (Xcode 11.0)
181-
182148
* [SR-8974][]:
183149

184150
Duplicate tuple element labels are no longer allowed, because it leads
@@ -7857,4 +7823,3 @@ Swift 1.0
78577823
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
78587824
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
78597825
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
7860-
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>

trunk/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,6 @@ if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
996996
-DCMAKE_CXX_COMPILER=${SWIFT_LIBDISPATCH_CXX_COMPILER}
997997
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
998998
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
999-
-DCMAKE_INSTALL_LIBDIR=lib
1000999
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
10011000
-DCMAKE_LINKER=${CMAKE_LINKER}
10021001
-DCMAKE_RANLIB=${CMAKE_RANLIB}

trunk/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
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)|
21+
|**[Debian 9.5](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_debian_9.5.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_5/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_5)|
2122
|**[Windows 2019](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)|
2223

2324
**Swift TensorFlow Community-Hosted CI Platforms**

trunk/cmake/modules/SwiftHandleGybSources.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
118118
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/AttributeNodes.py"
119119
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/AvailabilityNodes.py"
120120
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/CommonNodes.py"
121-
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/CompletionOnlyNodes.py"
122121
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/DeclNodes.py"
123122
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/ExprNodes.py"
124123
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/GenericNodes.py"

trunk/cmake/modules/SwiftSource.cmake

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,9 @@ function(_compile_swift_files
310310
set(module_base "${module_dir}/${SWIFTFILE_MODULE_NAME}")
311311
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
312312
set(specific_module_dir "${module_base}.swiftmodule")
313-
set(specific_module_private_dir "${specific_module_dir}/Private")
314-
set(source_info_file "${specific_module_private_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
315313
set(module_base "${module_base}.swiftmodule/${SWIFTFILE_ARCHITECTURE}")
316314
else()
317315
set(specific_module_dir)
318-
set(specific_module_private_dir)
319-
set(source_info_file "${module_base}.swiftsourceinfo")
320316
endif()
321317
set(module_file "${module_base}.swiftmodule")
322318
set(module_doc_file "${module_base}.swiftdoc")
@@ -353,8 +349,7 @@ function(_compile_swift_files
353349
swift_install_in_component(DIRECTORY "${specific_module_dir}"
354350
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
355351
COMPONENT "${SWIFTFILE_INSTALL_IN_COMPONENT}"
356-
OPTIONAL
357-
PATTERN "Private" EXCLUDE)
352+
OPTIONAL)
358353
else()
359354
swift_install_in_component(FILES ${module_outputs}
360355
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
@@ -495,11 +490,9 @@ function(_compile_swift_files
495490
COMMAND
496491
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
497492
${specific_module_dir}
498-
${specific_module_private_dir}
499493
COMMAND
500494
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
501495
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"
502-
"-emit-module-source-info-path" "${source_info_file}"
503496
${swift_flags} ${swift_module_flags} "@${file_path}"
504497
${command_touch_module_outputs}
505498
OUTPUT ${module_outputs}

trunk/docs/ABI/Mangling.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ Entities
290290
entity-spec ::= type 'fu' INDEX // implicit anonymous closure
291291
entity-spec ::= 'fA' INDEX // default argument N+1 generator
292292
entity-spec ::= 'fi' // non-local variable initializer
293-
entity-spec ::= 'fP' // property wrapper backing initializer
294293
entity-spec ::= 'fD' // deallocating destructor; untyped
295294
entity-spec ::= 'fd' // non-deallocating destructor; untyped
296295
entity-spec ::= 'fE' // ivar destroyer; untyped
@@ -481,7 +480,7 @@ Types
481480
type ::= 'Bf' NATURAL '_' // Builtin.Float<n>
482481
type ::= 'Bi' NATURAL '_' // Builtin.Int<n>
483482
type ::= 'BI' // Builtin.IntLiteral
484-
type ::= 'BO' // Builtin.UnknownObject (no longer a distinct type, but still used for AnyObject)
483+
type ::= 'BO' // Builtin.UnknownObject
485484
type ::= 'Bo' // Builtin.NativeObject
486485
type ::= 'Bp' // Builtin.RawPointer
487486
type ::= 'Bt' // Builtin.SILToken

trunk/docs/ARCOptimization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ is_unique performs depends on the argument type:
335335

336336
- Objective-C object types require an additional check that the
337337
dynamic object type uses native Swift reference counting:
338-
(unknown class reference, class existential)
338+
(Builtin.UnknownObject, unknown class reference, class existential)
339339

340340
- Bridged object types allow the dynamic object type check to be
341341
bypassed based on the pointer encoding:

trunk/docs/CToSwiftNameTranslation.md

Lines changed: 16 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -212,29 +212,6 @@ Additionally, typedefs for `void *` or `const void *` that are themselves annota
212212
If a typedef's underlying type is itself a "CF pointer" typedef, the "alias" typedef will be imported as a regular typealias, with the suffix "Ref" still dropped from its name (if present) unless doing so would conflict with another declaration in the same module as the typedef.
213213

214214

215-
## Objective-C Properties
216-
217-
By default, most property names are not transformed at all. However, if the getter of a property overrides a superclass or adopted protocol method that is also a property accessor, the Swift name of the overridden accessor's property will be used for consistency. If there's more than one such name, one is chosen arbitrarily.
218-
219-
Properties with the type `BOOL` or `Boolean` use the name of the getter as the name of the Swift property by default, rather than the name of the property in Objective-C. This accounts for a difference in Swift and Objective-C naming conventions for boolean properties that use "is".
220-
221-
```objc
222-
@property(getter=isContrivedExample) BOOL contrivedExample;
223-
@property BOOL hasAnotherForm;
224-
```
225-
226-
```swift
227-
var isContrivedExample: Bool { get set }
228-
var hasAnotherForm: Bool { get set }
229-
```
230-
231-
_This rule should probably have applied to C's native `bool` as well._
232-
233-
A property declaration with the `SwiftImportPropertyAsAccessors` API note will not be imported at all, and its accessors will be imported as methods. Additionally, properties whose names start with "accessibility" in the NSAccessibility protocol are always imported as methods, as are properties whose names start with "accessibility" in an `@interface` declaration (class or category) that provides the adoption of NSAccessibility.
234-
235-
_Objective-C code has historically not been consistent about whether the NSAccessibility declarations should be considered properties and therefore the Swift compiler chooses to import them as methods, as a sort of lowest common denominator._
236-
237-
238215
## `swift_private`
239216

240217
The `swift_private` Clang attribute prepends `__` onto the base name of any declaration being imported except initializers. For initializers with no arguments, a dummy `Void` argument with the name `__` is inserted; otherwise, the label for the first argument has `__` prepended. This transformation takes place after any other name manipulation, unless the declaration has a custom name. It will not occur if the declaration is an override; in that case the name needs to match the overridden declaration.
@@ -275,8 +252,6 @@ __attribute__((swift_name("SpacecraftCoordinates")))
275252
struct SPKSpacecraftCoordinates {
276253
double x, y, z, t; // space and time, of course
277254
};
278-
279-
// Usually seen as NS_SWIFT_NAME.
280255
```
281256
282257
```swift
@@ -312,10 +287,12 @@ The `swift_name` attribute can be used to give a C function a custom name. The v
312287
```objc
313288
__attribute__((swift_name("doSomething(to:bar:)")))
314289
void doSomethingToFoo(Foo *foo, int bar);
290+
291+
// Usually seen as NS_SWIFT_NAME.
315292
```
316293
317294
```swift
318-
func doSomething(to foo: UnsafeMutablePointer<Foo>, bar: Int32)
295+
func doSomething(foo: UnsafeMutablePointer<Foo>, bar: Int32)
319296
```
320297

321298
An underscore can be used in place of an empty parameter label, as in Swift.
@@ -393,6 +370,19 @@ extension Counter {
393370
}
394371
```
395372

373+
The getter/setter syntax also allows for subscripts by using the base name `subscript`.
374+
375+
```objc
376+
__attribute__((swift_name("getter:LinkedListOfInts.subscript(self:_:)")))
377+
int LinkedListGetAtIndex(const LinkedListOfInts *head, int index);
378+
```
379+
380+
```swift
381+
extension LinkedListOfInts {
382+
subscript(_ index: Int32) -> Int32 { get }
383+
}
384+
```
385+
396386
Finally, functions can be imported as initializers as well by using the base name `init`. These are considered "factory" initializers and are never inherited or overridable. They must not have a `self` parameter.
397387

398388
```objc
@@ -453,86 +443,4 @@ Although enumerators always have global scope in C, they are often imported as m
453443

454444
_Currently, `swift_name` does not even allow importing an enum case as a member of the enum type itself, even if the enum is not recognized as an `@objc` enum, error code enum, or option set (i.e. the situation where a case is imported as a global constant)._
455445

456-
457-
### Fields of structs and unions; Objective-C properties
458-
459-
The `swift_name` attribute can be applied to rename a struct or union field or an Objective-C property (whether on a class or a protocol). The value of the attribute must be a valid Swift identifier.
460-
461-
```objc
462-
struct SPKSpaceflightBooking {
463-
const SPKLocation * _Nullable destination;
464-
bool roundTrip __attribute__((swift_name("isRoundTrip")));
465-
};
466-
```
467-
468-
```swift
469-
struct SPKSpaceflightBooking {
470-
var destination: UnsafePointer<SPKLocation>?
471-
var isRoundTrip: Bool
472-
}
473-
```
474-
475-
476-
### Objective-C methods
477-
478-
The `swift_name` attribute can be used to give an Objective-C method a custom name. The value of the attribute must be a full Swift function name, including parameter labels.
479-
480-
```objc
481-
- (void)doSomethingToFoo:(Foo *)foo bar:(int)bar
482-
__attribute__((swift_name("doSomethingImportant(to:bar:)")));
483-
```
484-
485-
```swift
486-
func doSomethingImportant(to foo: UnsafeMutablePointer<Foo>, bar: Int32)
487-
```
488-
489-
As with functions, an underscore can be used to represent an empty parameter label.
490-
491-
Methods that follow the NSError out-parameter convention may provide one fewer parameter label than the number of parameters in the original method to indicate that a parameter should be dropped, but they do not have to. The `swift_error` attribute is still respected even when using a custom name for purposes of transforming an NSError out-parameter and the method return type.
492-
493-
```objc
494-
- (BOOL)doSomethingRiskyAndReturnError:(NSError **)error
495-
__attribute__((swift_name("doSomethingRisky()")));
496-
- (BOOL)doSomethingContrived:(NSString *)action error:(NSError **)outError
497-
__attribute__((swift_name("doSomethingContrived(_:error:)")));
498-
```
499-
500-
```swift
501-
func doSomethingRisky() throws
502-
func doSomethingContrived(_ action: String, error: ()) throws
503-
```
504-
505-
A base name of "init" can be used on a *class* method that returns `instancetype` or the containing static type in order to import that method as an initializer. Any other custom name *prevents* a class method from being imported as an initializer even if it would normally be inferred as one.
506-
507-
```objc
508-
+ (Action *)makeActionWithHandler:(void(^)(void))handler
509-
__attribute__((swift_name("init(handler:)")));
510-
+ (instancetype)makeActionWithName:(NSString *)name
511-
__attribute__((swift_name("init(name:)")));
512-
```
513-
514-
```swift
515-
/* non-inherited */ init(handler: () -> Void)
516-
init(name: String)
517-
```
518-
519-
A no-argument method imported as an initializer can be given a dummy argument label to disambiguate it from the no-argument `init()`, whether the method is an init-family instance method or a factory class method in Objective-C.
520-
521-
```objc
522-
- (instancetype)initSafely
523-
__attribute__((swift_name("init(safe:)")));
524-
+ (instancetype)makeDefaultAction
525-
__attribute__((swift_name("init(default:)")));
526-
```
527-
528-
```swift
529-
init(safe: ())
530-
init(default: ())
531-
```
532-
533-
A custom name on an instance method with one of Objective-C's subscript selectors (`objectAtIndexedSubscript:`, `objectForKeyedSubscript:`, `setObject:atIndexedSubscript:`, or `setObject:forKeyedSubscript:`) prevents that method from being imported as a subscript or used as the accessor for another subscript.
534-
535-
_Currently, this only works if *both* methods in a read/write subscript are given custom names; if just one is, a read/write subscript will still be formed. A read-only subscript only has one method to rename._
536-
537-
538446
## More to come...

trunk/docs/Diagnostics.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,3 @@ Most diagnostics have no reason to change behavior under editor mode. An example
104104
- `%error` - Represents a branch in a `%select` that should never be taken. In debug builds of the compiler this produces an assertion failure.
105105

106106
- `%%` - Emits a literal percent sign.
107-
108-
### Diagnostic Verifier ###
109-
110-
(This section is specific to the Swift compiler's diagnostic engine.)
111-
112-
If the `-verify` frontend flag is used, the Swift compiler will check emitted diagnostics against specially formatted comments in the source. This feature is used extensively throughout the test suite to ensure diagnostics are emitted with the correct message and source location.
113-
114-
An expected diagnostic is denoted by a comment which begins with `expected-error`, `expected-warning`, `expected-note`, or `expected-remark`. It is followed by:
115-
116-
- (Optional) Location information. By default, the comment will match any diagnostic emitted on the same line. However, it's possible to override this behavior and/or specify column information as well. `// expected-error@-1 ...` looks for an error on the previous line, `// expected-warning@+1:3 ...` looks for a warning on the next line at the third column, and `// expected-note@:7 ...` looks for a note on the same line at the seventh column.
117-
118-
- (Optional) A match count which specifies how many times the diagnostic is expected to appear. This may be a positive integer or `*`, which allows for zero or more matches. The match count must be surrounded by whitespace if present. For example, `// expected-error 2 ...` looks for two matching errors, and `// expected-warning * ...` looks for any number of matching warnings.
119-
120-
- (Required) The expected error message. The message should be enclosed in double curly braces and should not include the `error:`/`warning:`/`note:`/`remark:` prefix. For example, `// expected-error {{invalid redeclaration of 'y'}}` would match an error with that message on the same line. The expected message does not need to match the emitted message verbatim. As long as the expected message is a substring of the original message, they will match.
121-
122-
- (Optional) Expected fix-its. These are each enclosed in double curly braces and appear after the expected message. An expected fix-it consists of a column range followed by the text it's expected to be replaced with. For example, `let r : Int i = j // expected-error{{consecutive statements}} {{12-12=;}}` will match a fix-it attached to the consecutive statements error which inserts a semicolon at column 12, just after the 't' in 'Int'. The special {{none}} specifier is also supported, which will cause the diagnostic match to fail if unexpected fix-its are produced.

0 commit comments

Comments
 (0)