This really feels like a bug to me, but it’s hard to be 100% sure. I have InfersIsolatedConformances enabled.
nonisolated protocol A {
func requirement()
}
@MainActor
protocol MainActorA: A {
}
@MainActor
// error: Conformance of 'MyType' to protocol 'MainActorA' crosses into main actor-isolated code and can cause data races
struct MyType: MainActorA {
func requirement() {
}
}
What I think is happening is, because MainActorA has added isolation, the compiler doesn’t think that an isolated conformance is necessary. But making it explicit works.
hmm, yeah seems likely to be a bug to me, or at least something that could be better explained in the diagnostic feedback. the fact that the initial repro does not occur without default main actor isolation is a further mystery... @Douglas_Gregor@hborla does this error make sense to either of you?