Skip to content

Inference system broke after enabling SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES #85108

@miku1958

Description

@miku1958

Description

Inference system broke after enabling SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES

Reproduction

Code like:

enum ImageName {
    case one
    case two
}

func test(_ arr: [Int]) -> ImageName {
    arr.map { _ in .one }.first!
}

can be inferred correctly before enabling the flag, but will throw an error after enabling it.

More discussion: https://forums.swift.org/t/question-about-swift-upcoming-feature-infer-sendable-from-captures/82761/6

Expected behavior

This code compiles correctly when the flag is enabled.

Environment

swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
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.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions