Open
Description
Description
Sendability checking seems to use sugared names for checking but protocol conformance uses the unsugared name. This results in errors with or without the sendability conformance for certain imported types.
Reproduction
import WinSDK
#if DEFINE_RETROACTIVE_CONFORMANCE
extension HANDLE: @retroactive @unchecked Sendable { }
#endif
final class S: Sendable {
private let hFile: HANDLE
public init(hFile: HANDLE) {
self.hFile = hFile
}
}
This errors with and without:
> swiftc -c reduced.swift -o NUL
reduced.swift:8:17: warning: stored property 'hFile' of 'Sendable'-conforming class 'S' has non-Sendable type 'HANDLE' (aka 'UnsafeMutableRawPointer'); this is an error in the Swift 6 language mode
6 |
7 | final class S: Sendable {
8 | private let hFile: HANDLE
| `- warning: stored property 'hFile' of 'Sendable'-conforming class 'S' has non-Sendable type 'HANDLE' (aka 'UnsafeMutableRawPointer'); this is an error in the Swift 6 language mode
9 | public init(hFile: HANDLE) {
10 | self.hFile = hFile
Swift.UnsafeMutableRawPointer:1:23: note: struct 'UnsafeMutableRawPointer' does not conform to the 'Sendable' protocol
1 | @frozen public struct UnsafeMutableRawPointer : @unsafe _Pointer {
| `- note: struct 'UnsafeMutableRawPointer' does not conform to the 'Sendable' protocol
2 | public typealias Pointee = UInt8
3 | public let _rawValue: Builtin.RawPointer
> swiftc -c reduced.swift -o NUL -D DEFINE_RETROACTIVE_CONFORMANCE
reduced.swift:4:43: warning: conformance of 'UnsafeMutableRawPointer' to protocol 'Sendable' was already stated in the type's module 'Swift'
2 |
3 | #if DEFINE_RETROACTIVE_CONFORMANCE
4 | extension HANDLE: @retroactive @unchecked Sendable { }
| `- warning: conformance of 'UnsafeMutableRawPointer' to protocol 'Sendable' was already stated in the type's module 'Swift'
5 | #endif
6 |
Swift.UnsafeMutableRawPointer:2:11: note: 'UnsafeMutableRawPointer' declares conformance to protocol 'Sendable' here
1 | @available(*, unavailable)
2 | extension UnsafeMutableRawPointer : Sendable {
| `- note: 'UnsafeMutableRawPointer' declares conformance to protocol 'Sendable' here
3 | }
Expected behavior
Expected this to not cause a warning.
Environment
> swiftc -version
Swift version 6.2-dev (LLVM 3c7e35ab7550a0a, Swift 4b8755968d5eb1e)
Target: x86_64-unknown-windows-msvc
Build config: +assertions
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
TODO