`@unknown default` produces a warning on Linux with non-frozen enum

The difference is due to the core libraries (including Dispatch) using library evolution mode on Darwin (because they are a stable part of the operating system) whereas everywhere else they use the normal mode, because their ABIs are not yet stable.

Differences found in the core libraries between platforms are usually considered bugs to be fixed, but this isn’t really Dispatch’s fault. The ultimate fix is for other platforms to reach ABI stability.

the clients of my library will stop compiling if a new case is added

That is already the case on all platforms. It’s what you are asking the compiler to do when you use @unknown. You’re saying, “If there is another known, I want to be warned that I’m forgetting it.”

This will compile without warnings on all platforms in the present, and will start errorring (during compilation) on all platforms if something is added:

// ...
case .nanoseconds(let n):
  print("\(n) nanoseconds")
case .never:
  print("never")
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
  @unknown default:
    print("unknown")
#endif
}

If you really do want to evade any future warnings on all platforms in the event of a new case being added, you can do it like this:


// ...
case .nanoseconds(let n):
  print("\(n) nanoseconds")
default:
  if case let .never = interval {
    print("never")
  } else {
    print("unknown")
  }
}