Files
swift-mirror/test/Concurrency/async_computed_property.swift
Evan Wilde 642392c790 Computed properties can't be async, don't even try
The fix-it was being a little too eager to label function decls async.
Computed properties, or AccessorDecls are function declarations, but
they don't have parentheses, so trying to add `async` to them causes
crashing. Furthermore, they can't be async at all, so suggesting that we
make them async is just wrong. We shouldn't give folks a glimmer of hope
where there is none to be had.
2021-03-18 18:07:26 -07:00

13 lines
332 B
Swift

// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
// REQUIRES: concurrency
func asyncFunc(_ value: String) async {}
class ComputedPropertyClass {
var meep: String {
//expected-error@+1:11{{'async' call in a function that does not support concurrency}}
await asyncFunc("Meep")
return "15"
}
}