Skip to content

Commit 05d3852

Browse files
authored
Stop using renamed pattern which can cause compiler crash (#183)
Motivation: Deprecation with rename fixit has been seen to cause compiler crashes in 5.x compiler versions. Modifications: Deprecate with message for 5.x compilers. Result: Compilation without failure in all scenarios
1 parent 12a031b commit 05d3852

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/ServiceLifecycle/GracefulShutdown.swift

+5
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ public func cancelWhenGracefulShutdown<T: Sendable>(_ operation: @Sendable @esca
157157
/// Cancels the closure when a graceful shutdown was triggered.
158158
///
159159
/// - Parameter operation: The actual operation.
160+
#if compiler(>=6.0)
160161
@available(*, deprecated, renamed: "cancelWhenGracefulShutdown")
162+
#else
163+
// renamed pattern has been shown to cause compiler crashes in 5.x compilers.
164+
@available(*, deprecated, message: "renamed to cancelWhenGracefulShutdown")
165+
#endif
161166
public func cancelOnGracefulShutdown<T: Sendable>(_ operation: @Sendable @escaping () async throws -> T) async rethrows -> T? {
162167
return try await cancelWhenGracefulShutdown(operation)
163168
}

0 commit comments

Comments
 (0)