Skip to content

Commit 743104e

Browse files
authored
Remove a number of checks for compilers < 6.1. (#1214)
This PR removes some old/dead code checking for compilers < 6.1. We do not support building with such compilers anymore. It also adopts the move-only-type-compatible `ObjectIdentifier.init` overload added with the 6.2 toolchain. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent ee1736d commit 743104e

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ and install a toolchain.
4848

4949
#### Installing a toolchain
5050

51-
1. Download a toolchain. A recent **6.0 development snapshot** toolchain is
52-
required to build the testing library. Visit
53-
[swift.org](http://swift.org/install) and download the most recent toolchain
54-
from the section titled **release/6.0** under **Development Snapshots** on
55-
the page for your platform.
51+
1. Download a toolchain. A recent **development snapshot** toolchain is required
52+
to build the testing library. Visit [swift.org](https://swift.org/install),
53+
select your platform, and download the most recent toolchain from the section
54+
titled **release/6.x** under **Development Snapshots**.
5655

5756
Be aware that development snapshot toolchains aren't intended for day-to-day
5857
development and may contain defects that affect the programs built with them.

Sources/Testing/Parameterization/TypeInfo.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,7 @@ extension TypeInfo {
308308
}
309309
switch _kind {
310310
case let .type(type):
311-
#if compiler(>=6.1)
312311
return _mangledTypeName(type)
313-
#else
314-
return _mangledTypeName(unsafeBitCast(type, to: Any.Type.self))
315-
#endif
316312
case let .nameOnly(_, _, mangledName):
317313
return mangledName
318314
}
@@ -412,6 +408,7 @@ extension TypeInfo: Hashable {
412408
}
413409
}
414410

411+
#if compiler(<6.2)
415412
// MARK: - ObjectIdentifier support
416413

417414
extension ObjectIdentifier {
@@ -426,6 +423,7 @@ extension ObjectIdentifier {
426423
self.init(unsafeBitCast(type, to: Any.Type.self))
427424
}
428425
}
426+
#endif
429427

430428
// MARK: - Codable
431429

Sources/Testing/Support/Locked+Platform.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension os_unfair_lock_s: Lockable {
4141
typealias pthread_mutex_t = _TestingInternals.pthread_mutex_t?
4242
#endif
4343

44-
#if SWT_TARGET_OS_APPLE || os(Linux) || os(Android) || (os(WASI) && compiler(>=6.1) && _runtime(_multithreaded)) || os(FreeBSD) || os(OpenBSD)
44+
#if SWT_TARGET_OS_APPLE || os(Linux) || os(Android) || (os(WASI) && _runtime(_multithreaded)) || os(FreeBSD) || os(OpenBSD)
4545
extension pthread_mutex_t: Lockable {
4646
static func initializeLock(at lock: UnsafeMutablePointer<Self>) {
4747
_ = pthread_mutex_init(lock, nil)
@@ -83,7 +83,7 @@ extension SRWLOCK: Lockable {
8383

8484
#if SWT_TARGET_OS_APPLE && !SWT_NO_OS_UNFAIR_LOCK
8585
typealias DefaultLock = os_unfair_lock
86-
#elseif SWT_TARGET_OS_APPLE || os(Linux) || os(Android) || (os(WASI) && compiler(>=6.1) && _runtime(_multithreaded)) || os(FreeBSD) || os(OpenBSD)
86+
#elseif SWT_TARGET_OS_APPLE || os(Linux) || os(Android) || (os(WASI) && _runtime(_multithreaded)) || os(FreeBSD) || os(OpenBSD)
8787
typealias DefaultLock = pthread_mutex_t
8888
#elseif os(Windows)
8989
typealias DefaultLock = SRWLOCK

Tests/TestingTests/Traits/ConditionTraitTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,25 @@
1212

1313
@Suite("Condition Trait Tests", .tags(.traitRelated))
1414
struct ConditionTraitTests {
15-
#if compiler(>=6.1)
1615
@Test(
1716
".enabled trait",
1817
.enabled { true },
1918
.bug("https://github.com/swiftlang/swift/issues/76409", "Verify the custom trait with closure causes @Test macro to fail is fixed")
2019
)
2120
func enabledTraitClosure() throws {}
22-
#endif
2321

2422
@Test(
2523
".enabled if trait",
2624
.enabled(if: true)
2725
)
2826
func enabledTraitIf() throws {}
2927

30-
#if compiler(>=6.1)
3128
@Test(
3229
".disabled trait",
3330
.disabled { false },
3431
.bug("https://github.com/swiftlang/swift/issues/76409", "Verify the custom trait with closure causes @Test macro to fail is fixed")
3532
)
3633
func disabledTraitClosure() throws {}
37-
#endif
3834

3935
@Test(
4036
".disabled if trait",

0 commit comments

Comments
 (0)