mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
42 lines
981 B
Swift
42 lines
981 B
Swift
// RUN: %target-typecheck-verify-swift -target %target-swift-5.1-abi-triple
|
|
|
|
// Currently, we don't support having property wrappers that are effectful.
|
|
// Eventually we'd like to add this.
|
|
|
|
@propertyWrapper
|
|
struct Abstraction<T> {
|
|
private var value : T
|
|
|
|
init(_ initial : T) { self.value = initial }
|
|
|
|
var wrappedValue : T {
|
|
get throws { return value } // expected-error{{property wrapper's 'wrappedValue' property cannot define an 'async' or 'throws' getter}}
|
|
}
|
|
|
|
// its OK to have effectful props that are not `wrappedValue`
|
|
|
|
var prop1 : T {
|
|
get async { value }
|
|
}
|
|
var prop2 : T {
|
|
get throws { value }
|
|
}
|
|
var prop3 : T {
|
|
get async throws { value }
|
|
}
|
|
}
|
|
|
|
@propertyWrapper
|
|
struct NeedlessIntWrapper {
|
|
var wrappedValue : Int {
|
|
get {}
|
|
}
|
|
}
|
|
|
|
struct S {
|
|
// expected-error@+1 {{property wrapper cannot be applied to a computed property}}
|
|
@NeedlessIntWrapper var throwingProp : Int {
|
|
get throws { 0 }
|
|
}
|
|
}
|