Skip to content

[Bug] Sendable Closures not propagating down into implementation #131

@gage-halverson-fetch

Description

@gage-halverson-fetch

Swift Version

6.0

Package Version

3a0127f

Bug Description

For this protocol

@Mocked
protocol TestProtocol: Sendable {
    func something(work: @escaping @Sendable () -> Void)
}

this Xcode error shows up when compiling in swift 6 mode

/var/folders/zh/vr7mqp6s529cv1tyb8y6rnt40000gn/T/swift-generated-sources/@__swiftmacro_15FetchFoundation16TestProtocolMockC9something13_MockedMethodfMp_.swift:37:13 Stored property '__something' of 'Sendable'-conforming class 'TestProtocolMock' contains non-Sendable type '() -> Void'

/var/folders/zh/vr7mqp6s529cv1tyb8y6rnt40000gn/T/swift-generated-sources/@__swiftmacro_15FetchFoundation16TestProtocolMockC9something13_MockedMethodfMp_.swift:37:13 Stored property '__something' of 'Sendable'-conforming class 'TestProtocolMock' contains non-Sendable type '(@escaping () -> Void) -> Void'

/var/folders/zh/vr7mqp6s529cv1tyb8y6rnt40000gn/T/swift-generated-sources/@__swiftmacro_15FetchFoundation16TestProtocolMockC9something13_MockedMethodfMp_.swift:37:13 Stored property '__something' of 'Sendable'-conforming class 'TestProtocolMock' contains non-Sendable type '() -> TestProtocolMock.SomethingImplementation<() -> Void>.Closure?' (aka '() -> Optional<(@escaping @Sendable () -> ()) -> ()>')

Steps to Reproduce

Turn on strict concurrency with swift 6 compiler mode

@Mocked
protocol TestProtocol: Sendable {
    func something(work: @escaping @Sendable () -> Void)
}

Expected Behavior

No errors

Actual Behavior

No response

Stack Trace / Logs

/var/folders/zh/vr7mqp6s529cv1tyb8y6rnt40000gn/T/swift-generated-sources/@__swiftmacro_15FetchFoundation16TestProtocolMockC9something13_MockedMethodfMp_.swift:37:13 Stored property '__something' of 'Sendable'-conforming class 'TestProtocolMock' contains non-Sendable type '() -> Void'

/var/folders/zh/vr7mqp6s529cv1tyb8y6rnt40000gn/T/swift-generated-sources/@__swiftmacro_15FetchFoundation16TestProtocolMockC9something13_MockedMethodfMp_.swift:37:13 Stored property '__something' of 'Sendable'-conforming class 'TestProtocolMock' contains non-Sendable type '(@escaping () -> Void) -> Void'

/var/folders/zh/vr7mqp6s529cv1tyb8y6rnt40000gn/T/swift-generated-sources/@__swiftmacro_15FetchFoundation16TestProtocolMockC9something13_MockedMethodfMp_.swift:37:13 Stored property '__something' of 'Sendable'-conforming class 'TestProtocolMock' contains non-Sendable type '() -> TestProtocolMock.SomethingImplementation<() -> Void>.Closure?' (aka '() -> Optional<(@escaping @Sendable () -> ()) -> ()>')

Additional Context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions