Skip to content

Commit 0538f22

Browse files
authored
Revert #916 and apply a slightly different change. (#917)
Thank you to @tshortli for the patch! We don't actually _need_ this property to be unavailable on WASI—it was just meant as a convenience. But since we're not using the property for anything at this time (a future PR might try to productize `TestContentRecord`), it's overkill. So instead I'll just leave the property available, and document it's always `nil` on statically-linked platforms. ### 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 9042721 commit 0538f22

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Sources/Testing/Discovery.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,19 @@ protocol TestContent: ~Copyable {
7878
struct TestContentRecord<T>: Sendable where T: ~Copyable {
7979
/// The base address of the image containing this instance, if known.
8080
///
81-
/// This property is not available on platforms such as WASI that statically
82-
/// link to the testing library.
81+
/// On platforms such as WASI that statically link to the testing library, the
82+
/// value of this property is always `nil`.
8383
///
8484
/// - Note: The value of this property is distinct from the pointer returned
8585
/// by `dlopen()` (on platforms that have that function) and cannot be used
8686
/// with interfaces such as `dlsym()` that expect such a pointer.
87-
#if SWT_NO_DYNAMIC_LINKING
88-
@available(*, unavailable, message: "Image addresses are not available on this platform.")
89-
nonisolated(unsafe) var imageAddress: UnsafeRawPointer? {
90-
get { fatalError() }
91-
set { fatalError() }
92-
}
93-
#else
9487
nonisolated(unsafe) var imageAddress: UnsafeRawPointer?
95-
#endif
9688

9789
/// The underlying test content record loaded from a metadata section.
9890
private var _record: __TestContentRecord
9991

10092
fileprivate init(imageAddress: UnsafeRawPointer?, record: __TestContentRecord) {
101-
#if !SWT_NO_DYNAMIC_LINKING
10293
self.imageAddress = imageAddress
103-
#endif
10494
self._record = record
10595
}
10696
}

0 commit comments

Comments
 (0)