Skip to content

Commit cae5c18

Browse files
committed
[test] Confess that Unmanaged’s hacky Equatable conformance is retroactive
1 parent 581fb9e commit cae5c18

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Tests/AtomicsTests/Basics/BasicTestSupport.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift Atomics open source project
44
//
5-
// Copyright (c) 2020 - 2023 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2020 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -12,11 +12,19 @@
1212

1313
import Atomics
1414

15+
#if compiler(>=6.0)
16+
extension Unmanaged: @retroactive Equatable { // FIXME: This is terrible
17+
public static func ==(left: Self, right: Self) -> Bool {
18+
left.toOpaque() == right.toOpaque()
19+
}
20+
}
21+
#else
1522
extension Unmanaged: Equatable { // FIXME: This is terrible
1623
public static func ==(left: Self, right: Self) -> Bool {
1724
left.toOpaque() == right.toOpaque()
1825
}
1926
}
27+
#endif
2028

2129
struct Foo: Equatable, CustomStringConvertible {
2230
var value: Int

0 commit comments

Comments
 (0)