Skip to content

Commit 9cc817d

Browse files
committed
Merge branch 'master' into fix-ordering
2 parents 1d22773 + 66b1830 commit 9cc817d

File tree

530 files changed

+17223
-13027
lines changed

Some content is hidden

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

530 files changed

+17223
-13027
lines changed

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,46 @@ CHANGELOG
2424
Swift 5.0
2525
---------
2626

27+
* [SR-7251][]:
28+
29+
In Swift 5 mode, attempting to declare a static property with the same name as a
30+
nested type is now always correctly rejected. Previously, it was possible to
31+
perform such a redeclaration in an extension of a generic type.
32+
33+
For example:
34+
```swift
35+
struct Foo<T> {}
36+
extension Foo {
37+
struct i {}
38+
39+
// compiler error: Invalid redeclaration of 'i'
40+
// (prior to Swift 5, this did not produce an error)
41+
static var i: Int { return 0 }
42+
}
43+
```
44+
45+
* [SR-4248][]:
46+
47+
In Swift 5 mode, when casting an optional value to a generic placeholder type,
48+
the compiler will be more conservative with the unwrapping of the value. The
49+
result of such a cast now more closely matches the result you would get in a
50+
non-generic context.
51+
52+
For example:
53+
```swift
54+
func forceCast<U>(_ value: Any?, to type: U.Type) -> U {
55+
return value as! U
56+
}
57+
58+
let value: Any? = 42
59+
print(forceCast(value, to: Any.self))
60+
// prints: Optional(42)
61+
// (prior to Swift 5, this would print: 42)
62+
63+
print(value as! Any)
64+
// prints: Optional(42)
65+
```
66+
2767
* [SE-0227][]:
2868

2969
Key paths now support the `\.self` keypath, which is a `WritableKeyPath`
@@ -7190,3 +7230,5 @@ Swift 1.0
71907230
[SR-2388]: <https://bugs.swift.org/browse/SR-2388>
71917231
[SR-2394]: <https://bugs.swift.org/browse/SR-2394>
71927232
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
7233+
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
7234+
[SR-7251]: <https://bugs.swift.org/browse/SR-7251>

CMakeLists.txt

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
187187
"Path to the directory that contains the Android NDK tools that are executable on the build machine")
188188
set(SWIFT_ANDROID_NDK_GCC_VERSION "" CACHE STRING
189189
"The GCC version to use when building for Android. Currently only 4.9 is supported.")
190-
set(SWIFT_ANDROID_SDK_PATH "" CACHE STRING
191-
"Path to the directory that contains the Android SDK tools that will be passed to the swiftc frontend")
192190
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
193191
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
194192

@@ -637,7 +635,6 @@ endif()
637635
# To fix it, we would need to append the architecture to the SDKs,
638636
# for example: 'OSX-x86_64;IOS-armv7;...etc'.
639637
# We could easily do that - we have all of that information in build-script-impl.
640-
# Also, we would need to be provided with the sysroot for each SDK (see SWIFT_ANDROID_SDK_PATH/SWIFT_SDK_ANDROID_PATH).
641638
# Darwin targets cheat and use `xcrun`.
642639

643640
if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
@@ -760,22 +757,29 @@ endif()
760757
# Should we cross-compile the standard library for Android?
761758
is_sdk_requested(ANDROID swift_build_android)
762759
if(swift_build_android AND NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
763-
764-
configure_sdk_unix(ANDROID "Android" "android" "android" "armv7" "armv7-none-linux-androideabi" "${SWIFT_ANDROID_SDK_PATH}")
765-
766-
if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"))
760+
if (NOT ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux"))
767761
message(FATAL_ERROR "A Darwin or Linux host is required to build the Swift runtime for Android")
768-
elseif(("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT swift_build_osx) OR
769-
("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT swift_build_linux))
762+
endif()
763+
764+
if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT swift_build_osx) OR
765+
("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT swift_build_linux))
770766
set(SWIFT_PRIMARY_VARIANT_SDK_default "ANDROID")
771767
set(SWIFT_PRIMARY_VARIANT_ARCH_default "armv7")
772768
endif()
769+
770+
if("${SWIFT_SDK_ANDROID_ARCHITECTURES}" STREQUAL "")
771+
set(SWIFT_SDK_ANDROID_ARCHITECTURES armv7;aarch)
772+
endif()
773+
configure_sdk_unix(ANDROID "Android" "android" "android" "${SWIFT_SDK_ANDROID_ARCHITECTURES}" "" "")
773774
endif()
774775

775776
# Should we cross-compile the standard library for Windows?
776777
is_sdk_requested(WINDOWS swift_build_windows)
777778
if(swift_build_windows AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
778-
configure_sdk_windows(WINDOWS "Windows" "msvc" "aarch64;armv7;i686;x86_64")
779+
if("${SWIFT_SDK_WINDOWS_ARCHITECTURES}" STREQUAL "")
780+
set(SWIFT_SDK_WINDOWS_ARCHITECTURES aarch64;armv7;i686;x86_64)
781+
endif()
782+
configure_sdk_windows(WINDOWS "Windows" "msvc" "${SWIFT_SDK_WINDOWS_ARCHITECTURES}")
779783
endif()
780784

781785
if("${SWIFT_SDKS}" STREQUAL "")
@@ -860,15 +864,14 @@ function(swift_icu_variables_set sdk arch result)
860864
endif()
861865
endfunction()
862866

863-
# ICU is provided through CoreFoundation on Darwin. On other hosts, assume that
864-
# we are compiling for the build as the host. In such a case, if the ICU
867+
# ICU is provided through CoreFoundation on Darwin. On other hosts, if the ICU
865868
# unicode and i18n include and library paths are not defined, perform a standard
866869
# package lookup. Otherwise, rely on the paths specified by the user. These
867870
# need to be defined when cross-compiling.
868871
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
869872
if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
870-
swift_icu_variables_set("${SWIFT_HOST_VARIANT_SDK_default}"
871-
"${SWIFT_HOST_VARIANT_ARCH_default}"
873+
swift_icu_variables_set("${SWIFT_PRIMARY_VARIANT_SDK}"
874+
"${SWIFT_PRIMARY_VARIANT_ARCH}"
872875
ICU_CONFIGURED)
873876
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "" AND NOT ${ICU_CONFIGURED})
874877
find_package(ICU REQUIRED COMPONENTS uc i18n)

0 commit comments

Comments
 (0)