jansorg / swift-plugin

Space of the Swift language support plugin for JetBrains IDEs
35 stars 0 forks source link

Await with assignment to existing variable not working #24

Closed avinizhanov closed 10 months ago

avinizhanov commented 10 months ago

This works fine:

try await viewModel.getDevice(id: id)

and one also works fine:

let device = try await viewModel.getDevice(id: id)

But if I try to assign result to existing variable I get error:

var device: Device?
device = try await viewModel.getDevice(id: id)
'!', <prefix expression> or '?' expected, got 'await'

Looks like problem with await, because this one also works fine:

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

Plugin version: 0.17.0.123-232

jansorg commented 10 months ago

Thanks! I've fixed this for the next update and reported it upstream to the Swift grammar spec: https://github.com/apple/swift-book/issues/179