mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Make sure they handle the case when a property wrapper type's constructor is called with the first argument coming from the var initializer, and the rest from the custom attribute's argument.
22 lines
548 B
Plaintext
22 lines
548 B
Plaintext
@propertyWrapper
|
|
struct Wrapper<T> {
|
|
var wrappedValue: T
|
|
/*split:def*/init(initialValue: T, fieldName: String, special: Bool = false) {
|
|
wrappedValue = initialValue
|
|
}
|
|
}
|
|
let /*someValue:def*/<base>someValue</base> = "some"
|
|
struct User {
|
|
@/*split:call*/Wrapper(fieldName: "bar")
|
|
var bar = 10
|
|
|
|
@/*split:call*/Wrapper(fieldName: {
|
|
return /*someValue*/<base>someValue</base>
|
|
}(), special: true)
|
|
var complex: Int = {
|
|
return /*someValue*/<base>someValue</base>.starts(with: "b") ? 43 : 0
|
|
}()
|
|
}
|
|
|
|
|