Skip to content

Commit 4675f98

Browse files
committed
---
yaml --- r: 349329 b: refs/heads/master-next c: fca424b h: refs/heads/master i: 349327: c4c73f6
1 parent 77e6591 commit 4675f98

File tree

2,834 files changed

+123371
-231158
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,834 files changed

+123371
-231158
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: abb5afbde20684e3f07d17d5e3ca243529b0ecae
3+
refs/heads/master-next: fca424b3ab23402b6128ee36af97ba2a82bfedb8
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/CHANGELOG.md

Lines changed: 11 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -26,137 +26,28 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

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-
```
60-
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-
}
29+
* [SR-8974][]:
7130

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-
```
31+
Duplicate tuple element labels are no longer allowed, because it leads
32+
to incorrect behavior. For example:
10533

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-
}
11634
```
35+
let dupLabels: (foo: Int, foo: Int) = (foo: 1, foo: 2)
11736
118-
* [SE-0253][]:
119-
120-
Values of types that declare `func callAsFunction` methods can be called
121-
like functions. The call syntax is shorthand for applying
122-
`func callAsFunction` methods.
123-
124-
```swift
125-
struct Adder {
126-
var base: Int
127-
func callAsFunction(_ x: Int) -> Int {
128-
return x + base
129-
}
130-
}
131-
var adder = Adder(base: 3)
132-
adder(10) // returns 13, same as `adder.callAsFunction(10)`
37+
enum Foo { case bar(x: Int, x: Int) }
38+
let f: Foo = .bar(x: 0, x: 1)
13339
```
13440

135-
* `func callAsFunction` argument labels are required at call sites.
136-
* Multiple `func callAsFunction` methods on a single type are supported.
137-
* `mutating func callAsFunction` is supported.
138-
* `func callAsFunction` works with `throws` and `rethrows`.
139-
* `func callAsFunction` works with trailing closures.
140-
141-
* [SR-4206][]:
41+
will now be diagnosed as an error.
14242

143-
A method override is no longer allowed to have a generic signature with
144-
requirements not imposed by the base method. For example:
43+
Note: You can still use duplicate labels when declaring functions and
44+
subscripts, as long as the internal labels are different. For example:
14545

14646
```
147-
protocol P {}
148-
149-
class Base {
150-
func foo<T>(arg: T) {}
151-
}
152-
153-
class Derived: Base {
154-
override func foo<T: P>(arg: T) {}
155-
}
47+
func foo(bar x: Int, bar y: Int) {}
48+
subscript(a x: Int, a y: Int) -> Int {}
15649
```
15750

158-
will now be diagnosed as an error.
159-
16051
* [SR-6118][]:
16152

16253
Subscripts can now declare default arguments:
@@ -177,30 +68,6 @@ Swift Next
17768
Swift 5.1
17869
---------
17970

180-
### 2019-09-20 (Xcode 11.0)
181-
182-
* [SR-8974][]:
183-
184-
Duplicate tuple element labels are no longer allowed, because it leads
185-
to incorrect behavior. For example:
186-
187-
```
188-
let dupLabels: (foo: Int, foo: Int) = (foo: 1, foo: 2)
189-
190-
enum Foo { case bar(x: Int, x: Int) }
191-
let f: Foo = .bar(x: 0, x: 1)
192-
```
193-
194-
will now be diagnosed as an error.
195-
196-
Note: You can still use duplicate argument labels when declaring functions and
197-
subscripts, as long as the internal parameter names are different. For example:
198-
199-
```
200-
func foo(bar x: Int, bar y: Int) {}
201-
subscript(a x: Int, a y: Int) -> Int {}
202-
```
203-
20471
* [SE-0244][]:
20572

20673
Functions can now hide their concrete return type by declaring what protocols
@@ -7825,7 +7692,6 @@ Swift 1.0
78257692
[SE-0244]: <https://github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md>
78267693
[SE-0245]: <https://github.com/apple/swift-evolution/blob/master/proposals/0245-array-uninitialized-initializer.md>
78277694
[SE-0252]: <https://github.com/apple/swift-evolution/blob/master/proposals/0252-keypath-dynamic-member-lookup.md>
7828-
[SE-0253]: <https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
78297695
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
78307696

78317697
[SR-106]: <https://bugs.swift.org/browse/SR-106>
@@ -7842,7 +7708,6 @@ Swift 1.0
78427708
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
78437709
[SR-2672]: <https://bugs.swift.org/browse/SR-2672>
78447710
[SR-2688]: <https://bugs.swift.org/browse/SR-2688>
7845-
[SR-4206]: <https://bugs.swift.org/browse/SR-4206>
78467711
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
78477712
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
78487713
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>
@@ -7856,5 +7721,3 @@ Swift 1.0
78567721
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
78577722
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
78587723
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
7859-
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
7860-
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>

branches/master-next/CMakeLists.txt

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ option(SWIFT_BUILD_STATIC_SDK_OVERLAY
6161
"Build static variants of the Swift SDK overlay"
6262
FALSE)
6363

64-
option(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT
65-
"If not building stdlib, controls whether to build 'stdlib/toolchain' content"
66-
TRUE)
67-
6864
# In many cases, the CMake build system needs to determine whether to include
6965
# a directory, or perform other actions, based on whether the stdlib or SDK is
7066
# being built at all -- statically or dynamically. Please note that these
@@ -219,7 +215,7 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "" CACHE STRING
219215
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "" CACHE STRING
220216
"Path to the directory that contains Swift tools that are executable on the build machine")
221217

222-
option(SWIFT_ENABLE_MODULE_INTERFACES
218+
option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES
223219
"Generate .swiftinterface files alongside .swiftmodule files"
224220
TRUE)
225221

@@ -450,7 +446,7 @@ if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL MSVC)
450446
endif()
451447

452448
if(CMAKE_SYSTEM_NAME STREQUAL Darwin OR
453-
EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
449+
EXISTS ${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})
454450
set(SWIFT_BUILD_SYNTAXPARSERLIB_default TRUE)
455451
set(SWIFT_BUILD_SOURCEKIT_default TRUE)
456452
else()
@@ -499,18 +495,6 @@ include(CMakePushCheckState)
499495

500496
print_versions()
501497

502-
include(SwiftSharedCMakeConfig)
503-
504-
# NOTE: We include this before SwiftComponents as it relies on some LLVM CMake
505-
# functionality.
506-
# Support building Swift as a standalone project, using LLVM as an
507-
# external library.
508-
if(SWIFT_BUILT_STANDALONE)
509-
swift_common_standalone_build_config(SWIFT)
510-
else()
511-
swift_common_unified_build_config(SWIFT)
512-
endif()
513-
514498
include(SwiftComponents)
515499
include(SwiftHandleGybSources)
516500
include(SwiftSetIfArchBitness)
@@ -539,6 +523,16 @@ if(NOT CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
539523
OUTPUT_STRIP_TRAILING_WHITESPACE)
540524
endif()
541525

526+
include(SwiftSharedCMakeConfig)
527+
528+
# Support building Swift as a standalone project, using LLVM as an
529+
# external library.
530+
if(SWIFT_BUILT_STANDALONE)
531+
swift_common_standalone_build_config(SWIFT)
532+
else()
533+
swift_common_unified_build_config(SWIFT)
534+
endif()
535+
542536
get_filename_component(SWIFT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
543537
set(SWIFT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
544538
set(SWIFT_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
@@ -605,13 +599,7 @@ if(SWIFT_HOST_VARIANT_SDK)
605599
set(SWIFT_HOST_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
606600
else()
607601
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
608-
# CMake on an Android host sets this to Linux, so check for the ANDROID_DATA
609-
# environment variable to see if we're building on Android.
610-
if(NOT "$ENV{ANDROID_DATA}" STREQUAL "")
611-
set(SWIFT_HOST_VARIANT_SDK_default "ANDROID")
612-
else()
613-
set(SWIFT_HOST_VARIANT_SDK_default "LINUX")
614-
endif()
602+
set(SWIFT_HOST_VARIANT_SDK_default "LINUX")
615603
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
616604
set(SWIFT_HOST_VARIANT_SDK_default "FREEBSD")
617605
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
@@ -621,7 +609,6 @@ else()
621609
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku")
622610
set(SWIFT_HOST_VARIANT_SDK_default "HAIKU")
623611
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
624-
# CMAKE_SYSTEM_NAME might be set this way when cross-compiling to Android.
625612
set(SWIFT_HOST_VARIANT_SDK_default "ANDROID")
626613
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
627614
set(SWIFT_HOST_VARIANT_SDK_default "OSX")
@@ -634,9 +621,9 @@ endif()
634621
if(SWIFT_HOST_VARIANT_ARCH)
635622
set(SWIFT_HOST_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
636623
else()
637-
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
624+
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
638625
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
639-
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64")
626+
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
640627
set(SWIFT_HOST_VARIANT_ARCH_default "aarch64")
641628
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
642629
set(SWIFT_HOST_VARIANT_ARCH_default "powerpc64")
@@ -649,6 +636,8 @@ else()
649636
set(SWIFT_HOST_VARIANT_ARCH_default "armv6")
650637
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "armv7l|armv7-a")
651638
set(SWIFT_HOST_VARIANT_ARCH_default "armv7")
639+
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
640+
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
652641
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
653642
set(SWIFT_HOST_VARIANT_ARCH_default "itanium")
654643
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|i686)")
@@ -686,7 +675,7 @@ endif()
686675

687676
# FIXME: the parameters we specify in SWIFT_SDKS are lacking architecture specifics,
688677
# so we need to hard-code it. For example, the SDK for Android is just 'ANDROID',
689-
# and we have to specify SWIFT_SDK_ANDROID_ARCHITECTURES separately.
678+
# which we assume below to be armv7.
690679
# The iOS SDKs all have their architectures hardcoded because they are just specified by name (e.g. 'IOS' or 'WATCHOS').
691680
# We can't cross-compile the standard library for another linux architecture,
692681
# because the SDK list would just be 'LINUX' and we couldn't disambiguate it from the host.
@@ -748,16 +737,9 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "HAIKU")
748737
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "ANDROID")
749738

750739
set(SWIFT_HOST_VARIANT "android" CACHE STRING
751-
"Deployment OS for Swift host tools (the compiler) [android]")
752-
753-
set(SWIFT_ANDROID_NATIVE_SYSROOT "/data/data/com.termux/files" CACHE STRING
754-
"Path to Android sysroot, default initialized to the Termux app's layout")
755-
756-
if("${SWIFT_SDK_ANDROID_ARCHITECTURES}" STREQUAL "")
757-
set(SWIFT_SDK_ANDROID_ARCHITECTURES ${SWIFT_HOST_VARIANT_ARCH})
758-
endif()
740+
"Deployment OS for Swift host tools (the compiler) [android].")
759741

760-
configure_sdk_unix("Android" "${SWIFT_SDK_ANDROID_ARCHITECTURES}")
742+
configure_sdk_unix("Android" "${SWIFT_HOST_VARIANT_ARCH}")
761743
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
762744
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
763745

@@ -996,7 +978,6 @@ if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
996978
-DCMAKE_CXX_COMPILER=${SWIFT_LIBDISPATCH_CXX_COMPILER}
997979
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
998980
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
999-
-DCMAKE_INSTALL_LIBDIR=lib
1000981
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
1001982
-DCMAKE_LINKER=${CMAKE_LINKER}
1002983
-DCMAKE_RANLIB=${CMAKE_RANLIB}
@@ -1054,7 +1035,6 @@ if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
10541035
else()
10551036
set(SOURCEKIT_RUNTIME_DIR lib)
10561037
endif()
1057-
add_dependencies(sourcekit-inproc BlocksRuntime dispatch)
10581038
swift_install_in_component(FILES
10591039
$<TARGET_FILE:dispatch>
10601040
$<TARGET_FILE:BlocksRuntime>
@@ -1087,7 +1067,8 @@ endif()
10871067
#
10881068
# We must include stdlib/ before tools/ because stdlib/CMakeLists.txt
10891069
# declares the swift-stdlib-* set of targets. These targets will then
1090-
# implicitly depend on any targets declared with IS_STDLIB.
1070+
# implicitly depend on any targets declared with IS_STDLIB or
1071+
# TARGET_LIBRARY.
10911072
#
10921073
# One such library that declares IS_STDLIB is SwiftSyntax, living in
10931074
# tools/SwiftSyntax. If we include stdlib/ after tools/,
@@ -1099,15 +1080,10 @@ endif()
10991080
if(SWIFT_BUILD_STDLIB)
11001081
add_subdirectory(stdlib)
11011082
else()
1102-
if(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT)
1103-
add_subdirectory(stdlib/toolchain)
1104-
endif()
1105-
11061083
# Some tools (e.g. swift-reflection-dump) rely on a host swiftReflection, so
11071084
# ensure we build that when building tools.
11081085
if(SWIFT_INCLUDE_TOOLS)
11091086
add_subdirectory(stdlib/public/Reflection)
1110-
add_subdirectory(stdlib/public/SwiftShims)
11111087
endif()
11121088
endif()
11131089

0 commit comments

Comments
 (0)