EDIT: Please Ignore this message, which took SendableMetatype as a library-defined type
instead of
https://docs.swift.org/compiler/documentation/diagnostics/sendable-metatypes/
Also, it seems isolation declarations on a protocol should operate on sub-protocols:
https://forums.swift.org/t/default-main-actor-isolation-and-protocol-inheritance/80419/3
Sorry for the noise.
Let's hope someone can look at this issue.
Your code is probably a thin slice from a more complicated situation, so I'm reluctant to extend the discussion based on it...
But if you want to investigate further yourself, would it help to try declaring the protocol itself non-isolated, instead of isolating the sub-protocol?
public nonisolated protocol SendableMetatype { ... }
Reason being: In the recent proposed documentation (https://forums.swift.org/t/rfc-data-race-safety-chapter-in-the-tspl-language-reference) protocols seem to convey actor isolation from the protocol to a conforming type only when declared directly.
Swift only infers isolation from protocols when you write the conformance at the primary declaration
When the isolation is declared in an extension, the declaration is conveyed for only at the level of the extra member requirements (i.e., not applied to the conforming type):
If you write the conformance in an extension, then isolation inference only applies to requirements that are implemented in the extension.
Perhaps the extension case is closest to your code above, declaring an isolated subprotocol extending a protocol (with undeclared isolation):
If this is like an actor-isolated extension, the non-isolated isolation might apply only to members declared in the sub-protocol (in the snippet above, none), resulting in some problems.
To fix that (assuming that explicit nonisolated isolation is conveyed in the same way as actor isolation), perhaps start with direct nonisolated for the (library) protocol and then directly declare conformance of the (user/application) type to the protocol. If that works, introduce indirection to see where that breaks things.
Also it's not clear if the problem is the compiler inference or a failure of stdlib protocols to declare their isolation as nonisolated. You could start by avoiding them to get code working as it should (if that's even possible when your protocols tangle with Codable or Equatable). If it works, that suggests the problem is the nondeclaration of nonisolation for stdlib protocols, or perhaps compiler assumptions about protocols external to the module in default @MainActor mode.