Equatable with default actor isolation of MainActor

I filed the following issue on swiftlang/swift on GitHub (Aug 8th), and a followup the swift.org forums, but not getting any replies. As we near the release of Swift 6.2, I want to know if what I'm seeing below is expected, or if it's another case where the compiler needs a fix.

protocol P1: Equatable { }

struct S1: P1 { }
// Error: Conformance of 'S1' to protocol 'P1' crosses into main actor-isolated code an can cause data races

struct S1Workaround: @MainActor P1 { }	// OK

// Another potential workaround if `Equatable` conformance can be moved to the conforming type.
protocol P2 { }

struct S2: Equatable, P2 { }	// OK

There was a prior compiler bug fix which addressed inhereted protocols regarding @MainActor. For Equatable, one still has to use @MainActoreven when the default actor isolation is MainActor.

Also affects Hashable and any other protocol inheriting from Equatable.

Answered by DTS Engineer in 855536022

Thanks.

This is a very Swift focused issue, so I think it’s better we talk about it over on Swift Forums. I’ve replied on your thread over there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I filed the following issue on swiftlang/swift on GitHub (Aug 8th), and a followup the swift.org forums

Please provide links to those items.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks.

This is a very Swift focused issue, so I think it’s better we talk about it over on Swift Forums. I’ve replied on your thread over there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Equatable with default actor isolation of MainActor
 
 
Q