mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If we're emitting a designated constructor inside a constrained extension, we have to use the correct substitution map for calling the property wrapper backing initializer. Factor out the computation of this substitution map and use it consistently. Fixes <rdar://problem/59245068>.
36 lines
1022 B
Swift
36 lines
1022 B
Swift
// RUN: %target-swift-emit-silgen -primary-file %s | %FileCheck %s
|
|
|
|
@propertyWrapper
|
|
public struct Horse<Value> {
|
|
private var stored: Value
|
|
|
|
public var wrappedValue: Value {
|
|
get { stored }
|
|
set { stored = newValue }
|
|
}
|
|
|
|
public init(wrappedValue initialValue: Value) {
|
|
stored = initialValue
|
|
}
|
|
|
|
public var projectedValue: Self {
|
|
mutating get { self }
|
|
set { self = newValue }
|
|
}
|
|
}
|
|
|
|
public protocol Fuzzball {}
|
|
|
|
public struct Cat : Fuzzball {}
|
|
|
|
public struct Dog<Pet : Fuzzball> {
|
|
@Horse public var foo: Int = 17
|
|
}
|
|
|
|
extension Dog where Pet == Cat {
|
|
public init() {}
|
|
}
|
|
|
|
// CHECK-LABEL: sil [ossa] @$s39property_wrappers_constrained_extension3DogVA2A3CatVRszrlEACyAEGycfC : $@convention(method) (@thin Dog<Cat>.Type) -> Dog<Cat> {
|
|
// CHECK: [[FN:%.*]] = function_ref @$s39property_wrappers_constrained_extension3DogV4_foo33_{{.*}}LLAA5HorseVySiGvpfi : $@convention(thin) <τ_0_0 where τ_0_0 : Fuzzball> () -> Int
|
|
// CHECK: apply [[FN]]<Cat>() : $@convention(thin) <τ_0_0 where τ_0_0 : Fuzzball> () -> Int |