Files
swift-mirror/validation-test/compiler_crashers_2_fixed/sr10937.swift
Suyash Srijan a2d0bf6f9c [PropertyWrappers] When finding the initial value for the property, properly handle the situation where we have multiple attached property wrappers
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.
2019-11-07 21:27:52 +00:00

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()