Skip to content

Ambiguous type name 'AtomicRepresentation' in Swift 6.2/Xcode 26 beta 2 #82528

Open
@troughton

Description

@troughton

Description

In Xcode 26/Swift 6.2, there is now an ambiguity in e.g. UInt64.AtomicRepresentation between the definition in the Atomics package (necessary for back deployment) and the definition in the Synchronization module, even though Synchronization isn't explicitly imported. This doesn't show up in a reduced test case but does exhibit in the package https://github.com/troughton/Substrate; repro steps should be to clone that repo and run swift build within it. Since e.g. Atomics.UInt64.AtomicRepresentation isn't a valid qualified name, there doesn't seem to be any way to work around it locally.

What's particularly odd is that the error only shows up in the Substrate module, and not in e.g. its dependency SubstrateUtilities, even though SubstrateUtilities also uses .AtomicRepresentation.

An example of one of the errors is as follows:

/Users/thomas/Developer/Substrate/Sources/Substrate/RenderGraph/Queue.swift:28:68: error: ambiguous type name 'AtomicRepresentation' in 'UInt64'
 26 |     
 27 |     public let lastSubmittedCommands : UnsafeMutablePointer<UInt64.AtomicRepresentation>
 28 |     public let lastCompletedCommands : UnsafeMutablePointer<UInt64.AtomicRepresentation>
    |                                                                    `- error: ambiguous type name 'AtomicRepresentation' in 'UInt64'
 29 |     let commandSubmissionTimes : UnsafeMutablePointer<UInt64.AtomicRepresentation>
 30 |     let commandCompletionTimes : UnsafeMutablePointer<UInt64.AtomicRepresentation>

Synchronization.UInt64.AtomicRepresentation:3:20: note: found candidate with type 'UInt64.AtomicRepresentation' (aka '_Atomic64BitStorage')
1 | struct UInt64 {
2 | @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
3 |   public typealias AtomicRepresentation = _Atomic64BitStorage}
  |                    `- note: found candidate with type 'UInt64.AtomicRepresentation' (aka '_Atomic64BitStorage')
4 | 

/Users/thomas/Developer/Substrate/.build/checkouts/swift-atomics/Sources/Atomics/Conformances/autogenerated/IntegerConformances.swift:1444:17: note: found candidate with type 'UInt64.AtomicRepresentation'
1442 | extension UInt64: AtomicValue {
1443 |   @frozen
1444 |   public struct AtomicRepresentation {
     |                 `- note: found candidate with type 'UInt64.AtomicRepresentation'
1445 |     public typealias Value = UInt64
1446 | 

Reproduction

Clone https://github.com/troughton/Substrate and run swift build under Swift 6.2 (or open it in Xcode and build the "Substrate" target.

Expected behavior

The package should successfully compile, as it does under Swift 6.1.2.

Environment

swift-driver version: 1.127.5.3 Apple Swift version 6.2 (swiftlang-6.2.0.10.950 clang-1700.3.10.950)
Target: arm64-apple-macosx15.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.name lookupArea → compiler → type checker: Name lookuptype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions