We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a protocol is annotated with @MainActor, the generated mock is not main actor-isolated and doesn't compile.
@MainActor
Source:
@MainActor protocol MyProtocol { func foo() }
Generated:
public func mock(_ type: Example.MyProtocol.Protocol, file: StaticString = #file, line: UInt = #line) -> MyProtocolMock { return MyProtocolMock(sourceLocation: Mockingbird.SourceLocation(file, line)) }
The generated code results in a compile error:
Call to main actor-isolated initializer 'init(sourceLocation:)' in a synchronous nonisolated context
I think the generated mock() function needs to be @MainActor.
mock()
0.20.0
swift --version
The text was updated successfully, but these errors were encountered:
@onelittlefish any solution to this?
Sorry, something went wrong.
No branches or pull requests
New Issue Checklist
Overview
If a protocol is annotated with
@MainActor
, the generated mock is not main actor-isolated and doesn't compile.Example
Source:
Generated:
The generated code results in a compile error:
Expected Behavior
I think the generated
mock()
function needs to be@MainActor
.Environment
0.20.0
)swift --version
)The text was updated successfully, but these errors were encountered: