Skip to content

[SR-15678] "Capturing 'async let' variables is not supported" compilation error #57957

@swift-ci

Description

@swift-ci
Previous ID SR-15678
Radar None
Original Reporter restermans (JIRA User)
Type Bug
Environment

swiftc --version

swift-driver version: 1.26.9 Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)

Target: x86_64-apple-macosx12.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Concurrency
Assignee None
Priority Medium

md5: c8c7aed5b405714204b16916abd0cfa9

Issue Description:

Attempting to compile the following program taken from `async let` proposal page (SE-0317) fails with error: "Capturing 'async let' variables is not supported".

Task {
     async let name = "Alice"
     await greet { await name }    // Capturing 'async let' variables is not supported 
}

@discardableResult
func greet(_ f: () async -> String) async -> String { await f() }

While in the proposal it's stated that "It is legal to capture a async let in a non-escaping asynchronous closure" - https://github.com/apple/swift-evolution/blob/main/proposals/0317-async-let.md#async-let-and-closures

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconcurrencyFeature: 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