mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If a property has multiple property wrappers attached, we'll have multiple nested calls, where each call's argument is a call to construct the next wrapper in the chain. However, when we use multiple wrappers consecutively, we cannot just rely on the call's type matching the innermost wrapper's type, because it will match the first wrapper in the sequence of consective wrappers and we'll end up crashing in SILGen. So, we should check if the call's argument is another call and look into that before checking the types.
28 lines
436 B
Swift
28 lines
436 B
Swift
// RUN: %target-swift-frontend -emit-sil %s
|
|
|
|
@propertyWrapper
|
|
struct Foo<T> {
|
|
init(wrappedValue: T) {
|
|
self.wrappedValue = wrappedValue
|
|
}
|
|
|
|
var wrappedValue: T
|
|
}
|
|
|
|
@propertyWrapper
|
|
struct Bar<T> {
|
|
init(wrappedValue: T) {
|
|
self.wrappedValue = wrappedValue
|
|
}
|
|
|
|
var wrappedValue: T
|
|
}
|
|
|
|
struct Container {
|
|
@Foo @Foo var x: Int = 0
|
|
@Foo @Foo @Bar @Bar var y: Int = 1
|
|
@Foo @Bar @Foo @Foo var z: Int = 2
|
|
}
|
|
|
|
_ = Container()
|