Skip to content

Commit 4beb673

Browse files
tkremenekairspeedswift
authored andcommitted
Bump compiler version to Swift 5.1 (#24671)
* Bump version to Swift 5.1 * Update tests with compiler version bump * Undo flatMap and math obsolescences
1 parent da9f67c commit 4beb673

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

CMakeLists.txt

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

128128
set(SWIFT_VENDOR "" CACHE STRING
129129
"The vendor name of the Swift compiler")

stdlib/public/Platform/tgmath.swift.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import SwiftShims
1414

1515
// Generic functions implementable directly on FloatingPoint.
1616
@_transparent
17-
@available(swift, deprecated: 4.2, obsoleted: 5.1, renamed: "abs")
17+
@available(swift, deprecated: 4.2/*, obsoleted: 5.1*/, renamed: "abs")
1818
public func fabs<T: FloatingPoint>(_ x: T) -> T {
1919
return x.magnitude
2020
}
@@ -112,7 +112,7 @@ public func isnan<T: FloatingPoint>(_ value: T) -> Bool { fatalError() }
112112
@available(*, unavailable, message: "use the sign property.")
113113
public func signbit<T: FloatingPoint>(_ value: T) -> Int { fatalError() }
114114

115-
@available(swift, deprecated: 4.2, obsoleted: 5.1, message: "use the exponent property.")
115+
@available(swift, deprecated: 4.2/*, obsoleted: 5.1*/, message: "use the exponent property.")
116116
public func ilogb<T: BinaryFloatingPoint>(_ x: T) -> Int {
117117
return Int(x.exponent)
118118
}
@@ -352,7 +352,7 @@ public func remquo(_ x: ${T}, _ y: ${T}) -> (${T}, Int) {
352352
% if T == 'Float80':
353353
#if (arch(i386) || arch(x86_64)) && !os(Windows)
354354
% end
355-
@available(swift, deprecated: 4.2, obsoleted: 5.1, message:
355+
@available(swift, deprecated: 4.2/*, obsoleted: 5.1*/, message:
356356
"use ${T}(nan: ${T}.RawSignificand).")
357357
@_transparent
358358
public func nan(_ tag: String) -> ${T} {

stdlib/public/core/MigrationSupport.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ extension UnsafeMutableRawBufferPointer {
535535
// Note that the second overload is declared on a more specific protocol.
536536
// See: test/stdlib/StringFlatMap.swift for tests.
537537
extension Sequence {
538-
@available(swift, deprecated: 4.1, obsoleted: 5.1, renamed: "compactMap(_:)",
538+
@available(swift, deprecated: 4.1/*, obsoleted: 5.1 */, renamed: "compactMap(_:)",
539539
message: "Please use compactMap(_:) for the case where closure returns an optional value")
540540
public func flatMap<ElementOfResult>(
541541
_ transform: (Element) throws -> ElementOfResult?

test/IRGen/objc.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class WeakObjC {
147147
// CHECK: i32 1, !"Objective-C Version", i32 2}
148148
// CHECK: i32 1, !"Objective-C Image Info Version", i32 0}
149149
// CHECK: i32 1, !"Objective-C Image Info Section", !"__DATA,__objc_imageinfo,regular,no_dead_strip"}
150-
// 83887872 == (5 << 24) | (0 << 16) | (7 << 8).
150+
// 83953408 == (5 << 24) | (1 << 16) | (7 << 8).
151151
// 5 and 0 is the current major.minor version. 7 is the Swift ABI version.
152-
// CHECK: i32 4, !"Objective-C Garbage Collection", i32 83887872}
152+
// CHECK: i32 4, !"Objective-C Garbage Collection", i32 83953408}
153153
// CHECK: i32 1, !"Swift Version", i32 7}

test/Serialization/Recovery/types-5-to-4.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import Lib
1616
func requiresConformance(_: B_RequiresConformance<B_ConformsToProto>) {}
1717
func requiresConformance(_: B_RequiresConformance<C_RelyOnConformanceImpl.Assoc>) {}
1818

19-
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 5.0) because it has overridable members that could not be loaded in Swift 4.1.50}}
20-
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 5.0) because it has requirements that could not be loaded in Swift 4.1.50}}
19+
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 5.1) because it has overridable members that could not be loaded in Swift 4.1.50}}
20+
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 5.1) because it has requirements that could not be loaded in Swift 4.1.50}}
2121

2222
#else // TEST
2323

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %sourcekitd-test -req=compiler-version | %FileCheck %s
22

33
// CHECK: key.version_major: 5
4-
// CHECK: key.version_minor: 0
4+
// CHECK: key.version_minor: 1
55
// CHECK: key.version_patch: 0

utils/build_swift/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
CMAKE_GENERATOR = 'Ninja'
4141

4242
COMPILER_VENDOR = 'none'
43-
SWIFT_USER_VISIBLE_VERSION = CompilerVersion('5.0')
43+
SWIFT_USER_VISIBLE_VERSION = CompilerVersion('5.1')
4444
CLANG_USER_VISIBLE_VERSION = CompilerVersion('7.0.0')
4545
SWIFT_ANALYZE_CODE_COVERAGE = 'false'
4646

0 commit comments

Comments
 (0)