Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14074] Calling async functions without async produces incorrect diagnostic #56463

Closed
jshier opened this issue Jan 21, 2021 · 3 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself concurrency Feature: umbrella label for concurrency language features

Comments

@jshier
Copy link
Contributor

jshier commented Jan 21, 2021

Previous ID SR-14074
Radar rdar://problem/73460922
Original Reporter @jshier
Type Bug
Environment

Xcode 12.3, swift-DEVELOPMENT-SNAPSHOT-2021-01-19-a, 2020 iMac i9, macOS command line tool

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

md5: b8d957bcfa7a07a895e9a145a8df7793

is duplicated by:

  • SR-14150 Bogus Diagnostic When 'await' is Missing in async Closure Parameter

Issue Description:

There appear to have been previous attempts at improving the diagnostic produced when calling async functions without the async keyword. However, this behavior seems to have regressed (or I'm in the wrong context).

This code:

func makeNetworkCall(id: String) async throws -> String {}

runAsyncAndBlock {
    do {
        try makeNetworkCall(id: "1")
    } catch {
        
    }
}

Produces the diagnostic "'async' in a function that does not support concurrency". If I understand correctly it should instead say that the async keyword is required and offer a fixit to add it.

@typesanitizer
Copy link

@swift-ci create

@hborla
Copy link
Member

hborla commented May 5, 2021

I have a PR to improve the error message here: #37263

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@hborla
Copy link
Member

hborla commented Jan 23, 2024

Sorry, I forgot to close this when I merged the PR!

@hborla hborla closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself concurrency Feature: umbrella label for concurrency language features
Projects
None yet
Development

No branches or pull requests

3 participants