Skip to content

Grammar of "infix expression" does not allow await #179

@jansorg

Description

@jansorg

Location

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/summaryofthegrammar/#Expressions
in section "Grammar of an infix expression"

Description

AFAIK this is valid (user's bug report for the JetBrains Swift plugin):

var device: Device?
device = try await viewModel.getDevice(id: id)

and if I'm not mistaken this part of the grammar is missing the await support:

infix-expression → infix-operator prefix-expression
infix-expression → assignment-operator try-operator? prefix-expression
infix-expression → conditional-operator try-operator? prefix-expression
infix-expression → type-casting-operator
infix-expressions → infix-expression infix-expressions?

Correction

Add the await as it's supported by this?

# Grammar of an expression
expression → try-operator? await-operator? prefix-expression infix-expressions?
expression-list → expression | expression , expression-list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions