Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,10 @@ let package = Package(
exclude: ["CMakeLists.txt", "Testing.swiftcrossimport"],
cxxSettings: .packageSettings,
swiftSettings: .packageSettings + .enableLibraryEvolution() + .moduleABIName("Testing"),
linkerSettings: {
var result = [LinkerSetting]()
result += [
.linkedLibrary("execinfo", .when(platforms: [.custom("freebsd"), .openbsd]))
]
#if compiler(>=6.3)
result += [
.linkedLibrary("_TestingInterop"),
]
#endif
return result
}()
linkerSettings: [
.linkedLibrary("execinfo", .when(platforms: [.custom("freebsd"), .openbsd])),
.linkedLibrary("_TestingInterop"),
]
),
.testTarget(
name: "TestingTests",
Expand Down Expand Up @@ -372,9 +364,7 @@ extension Array where Element == PackageDescription.SwiftSetting {
static var packageSettings: Self {
var result = availabilityMacroSettings

#if compiler(>=6.3)
result.append(.treatWarning("ExplicitSendable", as: .warning))
#endif

if buildingForEmbedded {
result.append(.enableExperimentalFeature("Embedded"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public import WinSDK
/// }
extension AttachableImageFormat {
private static let _encoderPathExtensionsByCLSID = Result {
var result = [CLSID.Wrapper: [String]]()
var result = [CLSID: [String]]()

// Create an imaging factory.
let factory = try IWICImagingFactory.create()
Expand Down Expand Up @@ -69,7 +69,7 @@ extension AttachableImageFormat {
continue
}
let extensions = _pathExtensions(for: info)
result[CLSID.Wrapper(clsid)] = extensions
result[clsid] = extensions
}

return result
Expand Down Expand Up @@ -136,7 +136,7 @@ extension AttachableImageFormat {
0 == _wcsicmp(pathExtension, encoderExt)
}
}
}.map { $0.key.rawValue }
}.map(\.key)
}

/// Get the `CLSID` value of the WIC image encoder corresponding to the same
Expand Down Expand Up @@ -172,13 +172,13 @@ extension AttachableImageFormat {
static func appendPathExtension(for clsid: CLSID, to preferredName: String) -> String {
// If there's already a CLSID associated with the filename, and it matches
// the one passed to us, no changes are needed.
if let existingCLSID = computeEncoderCLSID(forPreferredName: preferredName), CLSID.Wrapper(clsid) == CLSID.Wrapper(existingCLSID) {
if let existingCLSID = computeEncoderCLSID(forPreferredName: preferredName), clsid == existingCLSID {
return preferredName
}

// Find the preferred path extension for the encoder with the given CLSID.
let encoderPathExtensionsByCLSID = (try? _encoderPathExtensionsByCLSID.get()) ?? [:]
if let ext = encoderPathExtensionsByCLSID[CLSID.Wrapper(clsid)]?.first {
if let ext = encoderPathExtensionsByCLSID[clsid]?.first {
return "\(preferredName).\(ext)"
}

Expand Down Expand Up @@ -221,10 +221,9 @@ extension AttachableImageFormat {
/// @Available(Swift, introduced: 6.3)
/// }
public init(encoderCLSID: CLSID, encodingQuality: Float = 1.0) {
let encoderCLSID = CLSID.Wrapper(encoderCLSID)
let kind: Kind = if encoderCLSID == CLSID.Wrapper(CLSID_WICPngEncoder) {
let kind: Kind = if encoderCLSID == CLSID_WICPngEncoder {
.png
} else if encoderCLSID == CLSID.Wrapper(CLSID_WICJpegEncoder) {
} else if encoderCLSID == CLSID_WICJpegEncoder {
.jpeg
} else {
.systemValue(encoderCLSID)
Expand Down Expand Up @@ -281,7 +280,7 @@ extension AttachableImageFormat.Kind: CustomStringConvertible, CustomDebugString
case .jpeg:
CLSID_WICJpegEncoder
case let .systemValue(clsid):
(clsid as! CLSID.Wrapper).rawValue
clsid as! CLSID
}
}

Expand All @@ -308,7 +307,7 @@ extension AttachableImageFormat.Kind: CustomStringConvertible, CustomDebugString
package var description: String {
let clsid = encoderCLSID
let encoderPathExtensionsByCLSID = (try? AttachableImageFormat._encoderPathExtensionsByCLSID.get()) ?? [:]
if let ext = encoderPathExtensionsByCLSID[CLSID.Wrapper(clsid)]?.first {
if let ext = encoderPathExtensionsByCLSID[clsid]?.first {
return "\(ext.uppercased()) format"
}
return Self._description(of: clsid)
Expand All @@ -318,7 +317,7 @@ extension AttachableImageFormat.Kind: CustomStringConvertible, CustomDebugString
let clsid = encoderCLSID
let clsidDescription = Self._description(of: clsid)
let encoderPathExtensionsByCLSID = (try? AttachableImageFormat._encoderPathExtensionsByCLSID.get()) ?? [:]
if let ext = encoderPathExtensionsByCLSID[CLSID.Wrapper(clsid)]?.first {
if let ext = encoderPathExtensionsByCLSID[clsid]?.first {
return "\(ext.uppercased()) format (\(clsidDescription))"
}
return clsidDescription
Expand Down
1 change: 0 additions & 1 deletion Sources/Overlays/_Testing_WinSDK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
Attachments/HICON+AttachableAsIWICBitmapSource.swift
Attachments/IWICBitmapSource+AttachableAsIWICBitmapSource.swift
Attachments/UnsafeMutablePointer+AttachableAsIWICBitmapSource.swift
Support/Additions/GUIDAdditions.swift
Support/Additions/IPropertyBag2Additions.swift
Support/Additions/IWICImagingFactoryAdditions.swift
ReexportTesting.swift)
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions Sources/Testing/ABI/EntryPoints/ABIEntryPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ extension ABI.v0 {
/// - Note: This function's name is prefixed with `swt_` instead of
/// `swift_testing_` for binary compatibility reasons. Future ABI entry point
/// functions should use the `swift_testing_` prefix instead.
#if compiler(>=6.3)
@c(swt_abiv0_getEntryPoint)
#else
@_cdecl("swt_abiv0_getEntryPoint")
#endif
@usableFromInline func abiv0_getEntryPoint() -> UnsafeRawPointer {
unsafeBitCast(ABI.v0.entryPoint, to: UnsafeRawPointer.self)
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Testing/Events/Event+FallbackHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
private import _TestingInternals

extension Event {
#if compiler(>=6.3) && !SWT_NO_INTEROP
#if !SWT_NO_INTEROP
private static let _fallbackEventHandler: SWTFallbackEventHandler? = {
_swift_testing_getFallbackEventHandler()
}()
Expand All @@ -26,7 +26,7 @@ extension Event {
/// currently-installed handler belongs to the testing library, returns
/// `false`.
borrowing func postToFallbackHandler(in context: borrowing Context) -> Bool {
#if compiler(>=6.3) && !SWT_NO_INTEROP
#if !SWT_NO_INTEROP
guard let fallbackEventHandler = Self._fallbackEventHandler else {
return false
}
Expand Down
13 changes: 0 additions & 13 deletions Sources/Testing/Events/TimeValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ struct TimeValue: Sendable {

@available(_clockAPI, *)
init(_ instant: SuspendingClock.Instant) {
#if compiler(>=6.3)
self.init(SuspendingClock().systemEpoch.duration(to: instant))
#else
self.init(unsafeBitCast(instant, to: Duration.self))
#endif
}
}

Expand All @@ -81,10 +77,6 @@ extension TimeValue: Codable {}

extension TimeValue: CustomStringConvertible {
var description: String {
#if os(WASI) && compiler(<6.3)
// BUG: https://github.com/swiftlang/swift/issues/72398
return String(describing: Duration(self))
#else
let (secondsFromAttoseconds, attosecondsRemaining) = attoseconds.quotientAndRemainder(dividingBy: 1_000_000_000_000_000_000)
let seconds = seconds + secondsFromAttoseconds
var milliseconds = attosecondsRemaining / 1_000_000_000_000_000
Expand All @@ -98,7 +90,6 @@ extension TimeValue: CustomStringConvertible {
}
return String(cString: buffer.baseAddress!)
}
#endif
}
}

Expand All @@ -114,11 +105,7 @@ extension Duration {
@available(_clockAPI, *)
extension SuspendingClock.Instant {
init(_ timeValue: TimeValue) {
#if compiler(>=6.3)
self = SuspendingClock().systemEpoch.advanced(by: Duration(timeValue))
#else
self = unsafeBitCast(Duration(timeValue), to: SuspendingClock.Instant.self)
#endif
}
}

Expand Down
15 changes: 0 additions & 15 deletions Sources/TestingMacros/ConditionMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -501,26 +501,11 @@ extension ExitTestConditionMacro {
in: context
)

// Create another local type for legacy test discovery.
var recordDecl: DeclSyntax?
#if compiler(<6.3)
let legacyEnumName = context.makeUniqueName("__🟡$")
recordDecl = """
enum \(legacyEnumName): Testing.__TestContentRecordContainer {
nonisolated static var __testContentRecord: Testing.__TestContentRecord6_2 {
unsafe \(enumName).testContentRecord
}
}
"""
#endif

decls.append(
"""
@available(*, deprecated, message: "This type is an implementation detail of the testing library. Do not use it directly.")
enum \(enumName) {
\(testContentRecordDecl)

\(recordDecl)
}
"""
)
Expand Down
15 changes: 0 additions & 15 deletions Sources/TestingMacros/SuiteDeclarationMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,6 @@ public struct SuiteDeclarationMacro: PeerMacro, Sendable {
)
)

#if compiler(<6.3)
// Emit a type that contains a reference to the test content record.
let enumName = context.makeUniqueName("__🟡$")
result.append(
"""
@available(*, deprecated, message: "This type is an implementation detail of the testing library. Do not use it directly.")
enum \(enumName): Testing.__TestContentRecordContainer {
nonisolated static var __testContentRecord: Testing.__TestContentRecord6_2 {
unsafe \(testContentRecordName)
}
}
"""
)
#endif

return result
}
}
2 changes: 0 additions & 2 deletions Sources/TestingMacros/Support/TestContentGeneration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func makeTestContentRecordDecl(named name: TokenSyntax, in typeName: TypeSyntax?
)
"""

#if compiler(>=6.3)
result = """
@used
\(result)
Expand Down Expand Up @@ -115,7 +114,6 @@ func makeTestContentRecordDecl(named name: TokenSyntax, in typeName: TypeSyntax?
"""
}
}
#endif

return result
}
15 changes: 0 additions & 15 deletions Sources/TestingMacros/TestDeclarationMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -482,21 +482,6 @@ public struct TestDeclarationMacro: PeerMacro, Sendable {
)
)

#if compiler(<6.3)
// Emit a type that contains a reference to the test content record.
let enumName = context.makeUniqueName(thunking: functionDecl, withPrefix: "__🟡$")
result.append(
"""
@available(*, deprecated, message: "This type is an implementation detail of the testing library. Do not use it directly.")
enum \(enumName): Testing.__TestContentRecordContainer {
nonisolated static var __testContentRecord: Testing.__TestContentRecord6_2 {
unsafe \(testContentRecordName)
}
}
"""
)
#endif

return result
}
}
10 changes: 1 addition & 9 deletions Sources/_TestingInterop/FallbackEventHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

#if compiler(>=6.3) && !SWT_NO_INTEROP
#if !SWT_NO_INTEROP
#if SWT_TARGET_OS_APPLE && !SWT_NO_OS_UNFAIR_LOCK && !hasFeature(Embedded)
private import _TestingInternals
#else
Expand Down Expand Up @@ -66,11 +66,7 @@ package typealias FallbackEventHandler = @Sendable @convention(c) (
/// Get the current fallback event handler.
///
/// - Returns: The currently-set handler function, if any.
#if compiler(>=6.3)
@c
#else
@_cdecl("_swift_testing_getFallbackEventHandler")
#endif
@usableFromInline
package func _swift_testing_getFallbackEventHandler() -> FallbackEventHandler? {
#if SWT_TARGET_OS_APPLE && !SWT_NO_OS_UNFAIR_LOCK && !hasFeature(Embedded)
Expand Down Expand Up @@ -102,11 +98,7 @@ package func _swift_testing_getFallbackEventHandler() -> FallbackEventHandler? {
/// The fallback event handler can only be installed once per process, typically
/// by the first testing library to run. If this function has already been
/// called and the handler set, it does not replace the previous handler.
#if compiler(>=6.3)
@c
#else
@_cdecl("_swift_testing_installFallbackEventHandler")
#endif
@usableFromInline
package func _swift_testing_installFallbackEventHandler(_ handler: FallbackEventHandler) -> CBool {
var result = false
Expand Down
5 changes: 0 additions & 5 deletions Tests/TestingMacrosTests/TestDeclarationMacroTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,8 @@ struct TestDeclarationMacroTests {
func differentFunctionTypes(input: String, expectedTypeName: String?, otherCode: String?) throws {
let (output, _) = try parse(input)

#if compiler(>=6.3)
#expect(output.contains("@section"))
#expect(!output.contains("__TestContentRecordContainer"))
#else
#expect(!output.contains("@section"))
#expect(output.contains("__TestContentRecordContainer"))
#endif
if let expectedTypeName {
#expect(output.contains(expectedTypeName))
}
Expand Down
Loading
Loading