Skip to content

Swift 6.1 regression in Sendable checking #78635

Open
@groue

Description

@groue

Description

The Swift 6.1 compiler does not compile code that compiles with the Swift 6.0 compiler.

Reproduction

Compile the code below from Xcode 16.2 (16C5032a) with swift-6.1-DEVELOPMENT-SNAPSHOT-2025-01-13-a.xctoolchain

import Foundation

enum MyEnum: Sendable {
    // Compiler error:
    // Associated value 'formatted' of 'Sendable'-conforming enum 'MyEnum'
    // has non-sendable type 'DateFormatter'
    case formatted(DateFormatter)
    
    nonisolated(unsafe) static let iso8601Formatter: ISO8601DateFormatter = {
        fatalError()
    }()
}

(Note that Foundation.DateFormatter is declared as Sendable).

Expected behavior

The code compiles, as it does with a Swift 6.0 compiler, because it is correct.

Environment

Development Snapshots swift-6.1-DEVELOPMENT-SNAPSHOT-2025-01-13-a

Additional information

This regression was found because Swift 6.1 can not compile https://github.com/groue/GRDB.swift/tree/v7.0.0-beta.6.

This kind of regression is supposed to be caught by https://github.com/swiftlang/swift-source-compat-suite, but unfortunately this is not possible: swiftlang/swift-source-compat-suite#963 :-/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions