Skip to content

_Lock Test Process (Windows branch): Kernel.Descriptor construction uses the wrong init label/type #8

Description

@coenttb

Problem

Tests/Support/_Lock Test Process/main.swift's Windows branch (#else at the bottom of the file) constructs the lock descriptor as:

descriptor: Kernel.Descriptor(rawValue: handle),

where handle is the HANDLE returned by CreateFileW. On Windows, Kernel.Descriptor resolves (via swift-kernel's Kernel = Windows.Kernel typealias → swift-windows's Windows.Kernel.Descriptor typealias) to Windows.\32`.Kernel.Descriptorinswift-microsoft/swift-windows-32`. That type's only public constructor is:

public init(_rawValue: UInt)

— label _rawValue, not rawValue, and it takes UInt, not HANDLE. This is a call-site defect against an existing, stable L2 API — not a capability gap — so it belongs here rather than on the Windows owner. The POSIX branch of the same file (line 253) already calls the equivalent correctly: Kernel.Descriptor(_rawValue: rawFd).

This is a second, independent compile-time defect in the same helper file's Windows branch, distinct from the Kernel.Lock.Kind / .Range / .Token / extended-.Error capability gap tracked at swift-microsoft/swift-windows-32#9. It surfaces once that gap is closed and the Windows branch compiles far enough to reach this call.

Observable outcome

The Windows branch's descriptor construction becomes:

descriptor: Kernel.Descriptor(_rawValue: UInt(bitPattern: handle)),

(or the ecosystem's canonical HANDLEUInt bit-pattern conversion, if composition/swift skill guidance names a different owner for that conversion — worth a quick check before landing, since a bespoke UInt(bitPattern:) at a call site is exactly the kind of reach-through the composition skill flags). A subsequent full-tier Windows (Swift 6.3, debug) CI run at swift-foundations/swift-kernel gets past this line once swift-microsoft/swift-windows-32#9 has landed and this fix is applied together with it — this issue alone does not turn the Windows leg green, since the Kind/Range/Token/Error gap still blocks compilation upstream of this line.

Scope note

Institute Work Project admission (i.e., whether this lands as scheduled/prioritized work) is a separate coordinator decision from this issue's filing.

Cross-references

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions