Skip to content

Commit 9df9e10

Browse files
committed
---
yaml --- r: 349046 b: refs/heads/master c: f27a58c h: refs/heads/master
1 parent 92bf478 commit 9df9e10

File tree

514 files changed

+10768
-14929
lines changed

Some content is hidden

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

514 files changed

+10768
-14929
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: f17bc674f3c9b1a251d06018d457c2f6dfe448aa
2+
refs/heads/master: f27a58c757068e2efbec04449846eb228befa125
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/.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

trunk/CHANGELOG.md

Lines changed: 77 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +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-
---------
26+
Swift Next
27+
----------
2828

2929
* [SR-11429][]:
3030

@@ -58,6 +58,63 @@ Swift 5.2
5858
(foo as Magic)(5)
5959
```
6060

61+
* [SR-11298][]:
62+
63+
A class-constrained protocol extension, where the extended protocol does
64+
not impose a class constraint, will now infer the constraint implicitly.
65+
66+
```swift
67+
protocol Foo {}
68+
class Bar: Foo {
69+
var someProperty: Int = 0
70+
}
71+
72+
// Even though 'Foo' does not impose a class constraint, it is automatically
73+
// inferred due to the Self: Bar constraint.
74+
extension Foo where Self: Bar {
75+
var anotherProperty: Int {
76+
get { return someProperty }
77+
// As a result, the setter is now implicitly nonmutating, just like it would
78+
// be if 'Foo' had a class constraint.
79+
set { someProperty = newValue }
80+
}
81+
}
82+
```
83+
84+
As a result, this could lead to code that currently compiles today to throw an error.
85+
86+
```swift
87+
protocol Foo {
88+
var someProperty: Int { get set }
89+
}
90+
91+
class Bar: Foo {
92+
var someProperty = 0
93+
}
94+
95+
extension Foo where Self: Bar {
96+
var anotherProperty1: Int {
97+
get { return someProperty }
98+
// This will now error, because the protocol requirement
99+
// is implicitly mutating and the setter is implicitly
100+
// nonmutating.
101+
set { someProperty = newValue } // Error
102+
}
103+
}
104+
```
105+
106+
**Workaround**: Define a new mutable variable inside the setter that has a reference to `self`:
107+
108+
```swift
109+
var anotherProperty1: Int {
110+
get { return someProperty }
111+
set {
112+
var mutableSelf = self
113+
mutableSelf.someProperty = newValue // Okay
114+
}
115+
}
116+
```
117+
61118
* [SE-0253][]:
62119

63120
Values of types that declare `func callAsFunction` methods can be called
@@ -83,7 +140,7 @@ Swift 5.2
83140

84141
* [SR-4206][]:
85142

86-
A method override is no longer allowed to have a generic signature with
143+
A method override is no longer allowed to have a generic signature with
87144
requirements not imposed by the base method. For example:
88145

89146
```
@@ -7799,4 +7856,5 @@ Swift 1.0
77997856
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
78007857
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
78017858
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
7859+
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
78027860
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>

trunk/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
125125
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
126126
# can be reused when a new version of Swift comes out (assuming the user hasn't
127127
# manually set it as part of their own CMake configuration).
128-
set(SWIFT_VERSION "5.1.1")
128+
set(SWIFT_VERSION "5.1")
129129

130130
set(SWIFT_VENDOR "" CACHE STRING
131131
"The vendor name of the Swift compiler")

trunk/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| | **Architecture** | **Master** | **Package** |
77
|---|:---:|:---:|:---:|
88
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
9+
| **Ubuntu 14.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04)|
910
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
1011
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
1112

trunk/cmake/modules/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ set(SWIFT_LIBRARY_DIRS ${SWIFT_LIBRARY_OUTPUT_INTDIR})
1616
configure_file(
1717
SwiftConfig.cmake.in
1818
${swift_cmake_builddir}/SwiftConfig.cmake
19-
@ONLY)
19+
@ONLY)

trunk/cmake/modules/SwiftConfig.cmake.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ set(SWIFT_VERSION @SWIFT_VERSION@)
66
set(SWIFT_MAIN_SRC_DIR @SWIFT_SOURCE_DIR@)
77

88
set(SWIFT_INCLUDE_DIRS "@SWIFT_INCLUDE_DIRS@")
9-
set(SWIFT_LIBRARY_DIRS "@SWIFT_LIBRARY_DIRS@")
9+
set(SWIFT_LIBRARY_DIRS "@SWIFT_CONFIG_LIBRARY_DIRS@")
1010

1111
# These variables are duplicated, but they must match the LLVM variables of the
1212
# same name. The variables ending in "S" could some day become lists, and are
1313
# preserved for convention and compatibility.
1414
set(SWIFT_INCLUDE_DIR "@SWIFT_INCLUDE_DIRS@")
15-
set(SWIFT_LIBRARY_DIR "@SWIFT_LIBRARY_DIRS@")
15+
set(SWIFT_LIBRARY_DIR "@SWIFT_CONFIG_LIBRARY_DIRS@")
1616

1717
set(SWIFT_CMAKE_DIR "@SWIFT_CMAKE_DIR@")
1818
set(SWIFT_BINARY_DIR "@SWIFT_BINARY_DIR@")

trunk/cmake/modules/SwiftSource.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ 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_project_dir "${specific_module_dir}/Project")
314-
set(source_info_file "${specific_module_project_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
313+
set(specific_module_private_dir "${specific_module_dir}/Private")
314+
set(source_info_file "${specific_module_private_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
315315
set(module_base "${module_base}.swiftmodule/${SWIFTFILE_ARCHITECTURE}")
316316
else()
317317
set(specific_module_dir)
318-
set(specific_module_project_dir)
318+
set(specific_module_private_dir)
319319
set(source_info_file "${module_base}.swiftsourceinfo")
320320
endif()
321321
set(module_file "${module_base}.swiftmodule")
@@ -354,7 +354,7 @@ function(_compile_swift_files
354354
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
355355
COMPONENT "${SWIFTFILE_INSTALL_IN_COMPONENT}"
356356
OPTIONAL
357-
PATTERN "Project" EXCLUDE)
357+
PATTERN "Private" EXCLUDE)
358358
else()
359359
swift_install_in_component(FILES ${module_outputs}
360360
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
@@ -495,7 +495,7 @@ function(_compile_swift_files
495495
COMMAND
496496
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
497497
${specific_module_dir}
498-
${specific_module_project_dir}
498+
${specific_module_private_dir}
499499
COMMAND
500500
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
501501
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"

trunk/docs/CToSwiftNameTranslation.md

Lines changed: 3 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.
@@ -453,86 +430,4 @@ Although enumerators always have global scope in C, they are often imported as m
453430

454431
_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)._
455432

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-
538433
## More to come...

trunk/docs/WindowsBuild.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,13 @@ cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
186186
md "S:\b\lldb"
187187
cd "S:\b\lldb"
188188
cmake -G Ninja^
189-
-DLLVM_DIR="S:/b/llvm/lib/cmake/llvm"^
190-
-DClang_DIR="S:/b/llvm/lib/cmake/clang"^
191-
-DSwift_DIR="S:/b/swift/lib/cmake/swift"^
192189
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
193190
-DLLDB_ALLOW_STATIC_BINDINGS=YES^
191+
-DLLDB_PATH_TO_CLANG_SOURCE="S:\clang"^
192+
-DLLDB_PATH_TO_SWIFT_SOURCE="S:\swift"^
193+
-DLLDB_PATH_TO_CLANG_BUILD="S:\b\llvm"^
194+
-DLLDB_PATH_TO_LLVM_BUILD="S:\b\llvm"^
195+
-DLLDB_PATH_TO_SWIFT_BUILD="S:\b\swift"^
194196
-DLLVM_ENABLE_ASSERTIONS=ON^
195197
-DPYTHON_HOME="%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Python37_64"^
196198
S:\lldb

trunk/include/swift/ABI/Metadata.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ struct TargetClassMetadata : public TargetAnyClassMetadata<Runtime> {
998998
using StoredPointer = typename Runtime::StoredPointer;
999999
using StoredSize = typename Runtime::StoredSize;
10001000

1001+
friend class ReflectionContext;
1002+
10011003
TargetClassMetadata() = default;
10021004
constexpr TargetClassMetadata(const TargetAnyClassMetadata<Runtime> &base,
10031005
ClassFlags flags,

trunk/include/swift/AST/ASTContext.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ namespace swift {
109109
class TypeAliasDecl;
110110
class VarDecl;
111111
class UnifiedStatsReporter;
112-
class IndexSubset;
113112

114113
enum class KnownProtocolKind : uint8_t;
115114

trunk/include/swift/AST/ASTDemangler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class ASTBuilder {
5858
using BuiltTypeDecl = swift::GenericTypeDecl *; // nominal or type alias
5959
using BuiltProtocolDecl = swift::ProtocolDecl *;
6060
explicit ASTBuilder(ASTContext &ctx) : Ctx(ctx) {}
61+
62+
/// The resolver to use for type checking, if necessary.
63+
LazyResolver *Resolver = nullptr;
6164

6265
ASTContext &getASTContext() { return Ctx; }
6366
DeclContext *getNotionalDC();

0 commit comments

Comments
 (0)