Files
swift-mirror/test/decl/var/effectful_properties_global.swift
Allan Shortlidge cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00

41 lines
1.0 KiB
Swift

// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple
var intAsyncProp : Int {
get async { 0 }
}
var intThrowsProp : Int {
get throws { 0 }
}
var asyncThrowsProp : Int {
get async throws { try await intAsyncProp + intThrowsProp }
}
func hello() async {
_ = intThrowsProp // expected-error{{property access can throw, but it is not marked with 'try' and the error is not handled}}
// expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
_ = intAsyncProp // expected-note{{property access is 'async'}}
}
class C {
var counter : Int = 0
}
var refTypeThrowsProp : C {
get throws { return C() }
}
var refTypeAsyncProp : C {
get async { return C() }
}
func salam() async {
_ = refTypeThrowsProp // expected-error{{property access can throw, but it is not marked with 'try' and the error is not handled}}
// expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
_ = refTypeAsyncProp // expected-note {{property access is 'async'}}
}