Skip to content

Commit f54d8b4

Browse files
author
Lance Parker
authored
[stdlib]Enable Swift 4 mode for the overlays (#12608)
Enable Swift 4 mode for the overlays
1 parent 2d0ed92 commit f54d8b4

File tree

9 files changed

+17
-12
lines changed

9 files changed

+17
-12
lines changed

cmake/modules/SwiftSource.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,15 @@ function(_compile_swift_files
256256
"-Xfrontend" "${GROUP_INFO_JSON_FILE}")
257257
endif()
258258

259-
# Force swift 3 compatibility mode for Standard Library and overlay.
260-
if (SWIFTFILE_IS_STDLIB OR SWIFTFILE_IS_SDK_OVERLAY)
259+
# Force swift 3 compatibility mode for Standard Library.
260+
if (SWIFTFILE_IS_STDLIB)
261261
list(APPEND swift_flags "-swift-version" "3")
262262
endif()
263+
264+
# Force swift 4 compatibility mode for overlays.
265+
if (SWIFTFILE_IS_SDK_OVERLAY)
266+
list(APPEND swift_flags "-swift-version" "4")
267+
endif()
263268

264269
if(SWIFTFILE_IS_SDK_OVERLAY)
265270
list(APPEND swift_flags "-autolink-force-load")

stdlib/public/SDK/AppKit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ add_swift_library(swiftAppKit ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SDK_OV
88
NSGraphics.swift
99
NSOpenGL.swift
1010

11-
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
11+
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "-swift-version" "3"
1212
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
1313
TARGET_SDKS OSX
1414
SWIFT_MODULE_DEPENDS_OSX Darwin CoreData CoreGraphics CoreImage Dispatch Foundation IOKit ObjectiveC QuartzCore XPC # auto-updated

stdlib/public/SDK/CoreGraphics/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ add_swift_library(swiftCoreGraphics ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_
66
CGFloat.swift.gyb
77
Private.swift
88

9-
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
9+
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "-swift-version" "3"
1010
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
1111
SWIFT_MODULE_DEPENDS_OSX Darwin CoreFoundation Dispatch IOKit ObjectiveC # auto-updated
1212
SWIFT_MODULE_DEPENDS_IOS Darwin CoreFoundation Dispatch ObjectiveC # auto-updated

stdlib/public/SDK/Foundation/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ add_swift_library(swiftFoundation ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SD
5757
UUID.swift
5858
CheckClass.mm
5959

60-
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "-Xllvm" "-sil-inline-generics" "-Xllvm" "-sil-partial-specialization"
60+
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "-Xllvm" "-sil-inline-generics" "-Xllvm" "-sil-partial-specialization" "-swift-version" "3"
6161
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
6262

6363
SWIFT_MODULE_DEPENDS_OSX Darwin CoreFoundation CoreGraphics Dispatch IOKit ObjectiveC # auto-updated

stdlib/public/SDK/Intents/INRideOption.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public protocol _INRideOptionMeteredFare {
2626
extension _INRideOptionMeteredFare {
2727
@available(swift, obsoleted: 4)
2828
@nonobjc
29-
public final var usesMeteredFare: NSNumber? {
29+
public var usesMeteredFare: NSNumber? {
3030
get {
3131
return __usesMeteredFare
3232
}

stdlib/public/SDK/Metal/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include("../../../../cmake/modules/StandaloneOverlay.cmake")
44
add_swift_library(swiftMetal ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
55
Metal.swift
66

7-
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
7+
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "-swift-version" "3"
88
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
99
TARGET_SDKS OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR
1010
SWIFT_MODULE_DEPENDS_OSX Darwin CoreFoundation CoreGraphics Dispatch Foundation IOKit ObjectiveC XPC # auto-updated

stdlib/public/SDK/MetalKit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include("../../../../cmake/modules/StandaloneOverlay.cmake")
44
add_swift_library(swiftMetalKit ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
55
MetalKit.swift
66

7-
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
7+
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "-swift-version" "3"
88
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
99
TARGET_SDKS OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR
1010
SWIFT_MODULE_DEPENDS_OSX Darwin AppKit CoreData CoreFoundation CoreGraphics CoreImage Dispatch Foundation IOKit Metal ModelIO ObjectiveC QuartzCore simd XPC # auto-updated

stdlib/public/SDK/SceneKit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include("../../../../cmake/modules/StandaloneOverlay.cmake")
44
add_swift_library(swiftSceneKit ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
55
SceneKit.swift.gyb
66

7-
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
7+
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "-swift-version" "3"
88
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
99
TARGET_SDKS OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR WATCHOS WATCHOS_SIMULATOR
1010
SWIFT_MODULE_DEPENDS_OSX Darwin AppKit CoreData CoreGraphics CoreImage Dispatch Foundation GLKit IOKit ObjectiveC QuartzCore simd XPC # auto-updated

stdlib/public/SDK/XCTest/XCTest.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public extension XCTContext {
4242
@available(macOS 10.11, *)
4343
public extension XCUIElement {
4444
/// Types a single key from the XCUIKeyboardKey enumeration with the specified modifier flags.
45-
@nonobjc public func typeKey(_ key: XCUIKeyboardKey, modifierFlags: XCUIKeyModifierFlags) {
45+
@nonobjc public func typeKey(_ key: XCUIKeyboardKey, modifierFlags: XCUIElement.KeyModifierFlags) {
4646
// Call the version of the method defined in XCTest.framework.
4747
typeKey(key.rawValue, modifierFlags: modifierFlags)
4848
}
@@ -55,11 +55,11 @@ public extension XCUIElement {
5555
func _XCTRegisterFailure(_ expected: Bool, _ condition: String, _ message: @autoclosure () -> String, _ file: StaticString, _ line: UInt) {
5656
// Call the real _XCTFailureHandler.
5757
let test = _XCTCurrentTestCase()
58-
_XCTPreformattedFailureHandler(test, expected, file.description, line, condition, message())
58+
_XCTPreformattedFailureHandler(test, expected, file.description, Int(line), condition, message())
5959
}
6060

6161
/// Produce a failure description for the given assertion type.
62-
func _XCTFailureDescription(_ assertionType: _XCTAssertionType, _ formatIndex: UInt, _ expressionStrings: CVarArg...) -> String {
62+
func _XCTFailureDescription(_ assertionType: _XCTAssertionType, _ formatIndex: Int, _ expressionStrings: CVarArg...) -> String {
6363
// In order to avoid revlock/submission issues between XCTest and the Swift XCTest overlay,
6464
// we are using the convention with _XCTFailureFormat that (formatIndex >= 100) should be
6565
// treated just like (formatIndex - 100), but WITHOUT the expression strings. (Swift can't

0 commit comments

Comments
 (0)