"Incorrect actor executor assumption" run-time error in Swift 6 mode

I have encountered a pretty strange run-time error in Swift 6 mode with the following code:

protocol P {
	var key: String { get }
}

@globalActor
actor GA {
	static var shared = GA()
}

@GA
class A: P {
	let key: String = "SomeKey"
}

let p: P = A()
print(p.key) // <- run-time error here

Looks like it's a result of a combination of a global actor and protocol. If I make A a normal actor, or if I remove the protocol and use an instance of A directly the error is not triggered.

What is the reason for this error and how do I fix it?

Also why would Swift 6 fail at run-time in such a trivial situation when it's supposed to guarantee concurrency safety at compile time?

Please include crash/error messages when saying "error here".

It sounds like something similar to what's going on here: Opening actor existentials breaks dynamic isolation checks inserted for @preconcurrency conformances #76507, i.e. something going wrong with the witnessing... We definitely should investigate and fix such.

Please file a github issue, with details about swift versions and exact error message etc.

1 Like

Sorry I should have mentioned that the app crashes with SIGABRT and the last thing I can see in the logs is the phrase "Incorrect actor executor assumption" and nothing else.

Could someone point me where I should file an issue exactly?

The "new issue" button over here: Issues ยท swiftlang/swift ยท GitHub it'll help us track the issue.

Thanks in advance.

1 Like