Skip to content

Commit 3a39848

Browse files
author
Max Moiseev
committed
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2 parents 55fde4c + 5869d04 commit 3a39848

File tree

741 files changed

+22788
-6507
lines changed

Some content is hidden

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

741 files changed

+22788
-6507
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ cscope.out
2828
#==============================================================================#
2929
# Directories to ignore (do not add trailing '/'s, they skip symlinks).
3030
#==============================================================================#
31-
# Swift performance test suite.
32-
benchmark/PerfTestSuite
33-
3431
# Generated docs
3532
docs/_build
3633

CHANGELOG.md

+45-16
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ Swift 2.2
1212
* Associated types in protocols can now be specified with a new 'associatedtype'
1313
declaration, to replace the use of 'typealias':
1414

15+
```swift
1516
protocol P {
1617
associatedtype Ty
1718
}
19+
```
1820

1921
The typealias keyword is still allowed (but deprecated and produces a warning)
2022
in Swift 2.2. This warning will become an error in Swift 3.
@@ -23,25 +25,42 @@ Swift 2.2
2325
Swift 3.
2426

2527
* The ++ and -- operators have been deprecated, and are slated to be removed in
26-
Swift 3.0. As a replacement, please use "x += 1" on integer or floating point
27-
types, and "x = x.successor()" on Index types.
28+
Swift 3.0. As a replacement, please use `x += 1` on integer or floating point
29+
types, and `x = x.successor()` on Index types.
2830

29-
* New #file, #line, #column, and #function expressions have been introduced to
30-
replace the existing __FILE__, __LINE__, __COLUMN__, and __FUNCTION__ symbols.
31-
The __FILE__-style symbols have been deprecated, and will be removed in
31+
* The implicit tuple splat behavior in function application has been deprecated
32+
and will be removed in Swift 3.0. For example, this code:
33+
34+
```swift
35+
func foo(a : Int, b : Int) { ... }
36+
let x = (1, b: 2)
37+
foo(x) // Warning, deprecated.
38+
```
39+
40+
should move to being written as:
41+
```swift
42+
foo(x.0, x.b)
43+
```
44+
45+
For more information and rationale, see
46+
[SE-0029](https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md).
47+
48+
* New `#file`, `#line`, `#column`, and `#function` expressions have been introduced to
49+
replace the existing `__FILE__`, `__LINE__`, `__COLUMN__`, and `__FUNCTION__` symbols.
50+
The `__FILE__`-style symbols have been deprecated, and will be removed in
3251
Swift 3.
3352

3453
* The operator identifier lexer grammar has been revised to simplify the rules
3554
for operators that start with a dot ("."). The new rule is that an operator
3655
that starts with a dot may contain other dots in it, but operators that start
3756
with some other character may not contain dots. For example:
3857

39-
```
58+
```swift
4059
x....foo --> "x" "...." "foo"
4160
x&%^.foo --> "x" "&%^" ".foo"
4261
```
4362

44-
This eliminates a special case for the ..< operator, folding it into a simple
63+
This eliminates a special case for the `..<` operator, folding it into a simple
4564
and consistent rule.
4665

4766
* The "C-style for loop", which is spelled `for init; comparison; increment {}`
@@ -59,7 +78,7 @@ Swift 2.2
5978
are specified.
6079

6180
* Designated class initializers declared as failable or throwing may now
62-
return nil or throw an error, respectively, before the object has been
81+
return `nil` or throw an error, respectively, before the object has been
6382
fully initialized. For example:
6483

6584
```swift
@@ -111,7 +130,9 @@ Swift 2.2
111130
* Argument labels and parameter names can now be any keyword except
112131
`var`, `let`, or `inout`. For example:
113132

133+
```swift
114134
NSURLProtectionSpace(host: "somedomain.com", port: 443, protocol: "https", realm: "Some Domain", authenticationMethod: "Basic")
135+
```
115136

116137
would previously have required `protocol` to be surrounded in
117138
back-ticks. For more information, see
@@ -133,11 +154,13 @@ Swift 2.2
133154
* When referencing a function or initializer, one can provide the
134155
complete name, including argument labels. For example:
135156

157+
```swift
136158
let fn1 = someView.insertSubview(_:at:)
137159
let fn2 = someView.insertSubview(_:aboveSubview:)
138160

139161
let buttonFactory = UIButton.init(type:)
140-
162+
```
163+
141164
For more information, see [SE-0021](https://github.com/apple/swift-evolution/blob/master/proposals/0021-generalized-naming.md).
142165

143166
* There is a new build configuration function, `#if swift(>=x.y)`, which
@@ -161,24 +184,30 @@ Swift 2.2
161184
* The Objective-C selector of a Swift method can now be determined
162185
directly with the #selector expression, e.g.,:
163186

187+
```swift
164188
let sel = #selector(insertSubview(_:aboveSubview:)) // sel has type Selector
165-
189+
```
190+
166191
Along with this change, the use of string literals as selectors has
167192
been deprecated, e.g.,
168193

194+
```swift
169195
let sel: Selector = "insertSubview:aboveSubview:"
170-
196+
```
197+
171198
Generally, such string literals should be replaced with uses of
172199
`#selector`, and the compiler will provide Fix-Its that use
173200
`#selector`. In cases where they is not possible (e.g., when referring
174201
to the getter of a property), one can still directly construct
175202
selectors, e.g.,:
176203

204+
```swift
177205
let sel = Selector("propertyName")
178-
206+
```
207+
179208
Note that the compiler is now checking the string literals used to
180209
construct Selectors to ensure that they are well-formed Objective-C
181-
selectors and that there is an '@objc' method with that selector.
210+
selectors and that there is an `@objc` method with that selector.
182211

183212

184213
2015-09-17 [Xcode 7.1, Swift 2.1]
@@ -1838,9 +1867,9 @@ Swift 2.2
18381867
}
18391868
```
18401869

1841-
In the current implementation, struct and enum initializers can return nil
1870+
In the current implementation, struct and enum initializers can return `nil`
18421871
at any point inside the initializer, but class initializers can only return
1843-
nil after all of the stored properties of the object have been initialized
1872+
`nil` after all of the stored properties of the object have been initialized
18441873
and `self.init` or `super.init` has been called. If `self.init` or
18451874
`super.init` is used to delegate to a failable initializer, then the `nil`
18461875
return is implicitly propagated through the current initializer if the
@@ -5269,7 +5298,7 @@ Swift 2.2
52695298
```
52705299

52715300
Swift also supports a special form of weak reference, called `[unowned]`, for
5272-
references that should never be nil but are required to be weak to break
5301+
references that should never be `nil` but are required to be weak to break
52735302
cycles, such as parent or sibling references. Accessing an `[unowned]`
52745303
reference asserts that the reference is still valid and implicitly promotes
52755304
the loaded reference to a strong reference, so it does not need to be loaded

CMakeLists.txt

+8-21
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,15 @@ option(SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
198198
"Should the runtime be built with support for non-thread-safe leak detecting entrypoints"
199199
FALSE)
200200

201-
option(SWIFT_STDLIB_USE_ASSERT_CONFIG_RELEASE
202-
"Should the stdlib be build with assert config set to release"
201+
option(SWIFT_STDLIB_ENABLE_RESILIENCE
202+
"Build the standard libraries and overlays with resilience enabled; see docs/LibraryEvolution.rst"
203203
FALSE)
204204

205+
if(SWIFT_SERIALIZE_STDLIB_UNITTEST AND SWIFT_STDLIB_ENABLE_RESILIENCE)
206+
message(WARNING "Ignoring SWIFT_SERIALIZE_STDLIB_UNITTEST because SWIFT_STDLIB_ENABLE_RESILIENCE is set")
207+
set(SWIFT_SERIALIZE_STDLIB_UNITTEST FALSE)
208+
endif()
209+
205210
option(SWIFT_XCODE_GENERATE_FOR_IDE_ONLY
206211
"Generate an Xcode project suitable for IDE use, but which cannot build"
207212
FALSE)
@@ -660,7 +665,7 @@ if(SWIFT_BUILD_TOOLS)
660665
endif()
661666
add_subdirectory(utils)
662667
add_subdirectory(stdlib)
663-
if(SWIFT_BUILD_PERF_TESTSUITE)
668+
if(SWIFT_BUILD_PERF_TESTSUITE AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
664669
add_subdirectory(benchmark)
665670
endif()
666671
if(SWIFT_INCLUDE_TESTS)
@@ -690,21 +695,3 @@ if(XCODE)
690695
add_custom_target(Miscellaneous
691696
SOURCES ${SWIFT_TOPLEVEL_HEADERS})
692697
endif()
693-
694-
# Configure CPack.
695-
set(CPACK_GENERATOR "TGZ")
696-
set(CPACK_PACKAGE_RELOCATABLE "false")
697-
set(CPACK_PACKAGE_VENDOR "LLVM Project")
698-
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "OFF")
699-
set(CPACK_SET_DESTDIR "ON")
700-
701-
set(CPACK_PACKAGE_NAME "swift")
702-
set(CPACK_SYSTEM_NAME "macosx")
703-
704-
# FIXME: Real version number.
705-
execute_process(COMMAND date "+%Y%m%d"
706-
OUTPUT_VARIABLE CPACK_PACKAGE_VERSION
707-
OUTPUT_STRIP_TRAILING_WHITESPACE)
708-
709-
# CPack must be included *after* its configuration variables are set.
710-
include(CPack)

0 commit comments

Comments
 (0)