|
9 | 9 |
|
10 | 10 | @propertyWrapper
|
11 | 11 | public struct Wrapper<T> {
|
12 |
| - public var value: T |
| 12 | + public var wrappedValue: T |
13 | 13 |
|
14 |
| - public var wrappedValue: T { |
15 |
| - get { value } |
16 |
| - set { value = newValue } |
| 14 | + public init(wrappedValue: T) { |
| 15 | + self.wrappedValue = wrappedValue |
17 | 16 | }
|
18 | 17 | }
|
19 | 18 |
|
20 | 19 | @propertyWrapper
|
21 | 20 | public struct WrapperWithInitialValue<T> {
|
22 |
| - private var value: T |
23 |
| - |
24 |
| - public var wrappedValue: T { |
25 |
| - get { value } |
26 |
| - set { value = newValue } |
27 |
| - } |
| 21 | + public var wrappedValue: T |
28 | 22 |
|
29 | 23 | public init(initialValue: T) {
|
30 |
| - self.value = initialValue |
| 24 | + self.wrappedValue = initialValue |
31 | 25 | }
|
32 | 26 |
|
33 | 27 | public init(alternate value: T) {
|
34 |
| - self.value = value |
| 28 | + self.wrappedValue = value |
35 | 29 | }
|
36 | 30 |
|
37 | 31 | public var projectedValue: Wrapper<T> {
|
38 |
| - get { Wrapper(value: value) } |
39 |
| - set { value = newValue.value } |
| 32 | + get { Wrapper(wrappedValue: wrappedValue) } |
| 33 | + set { wrappedValue = newValue.wrappedValue } |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +@propertyWrapper |
| 38 | +public struct ProjectedValueWrapper<T> { |
| 39 | + public var wrappedValue: T |
| 40 | + |
| 41 | + public init(wrappedValue: T) { |
| 42 | + self.wrappedValue = wrappedValue |
| 43 | + } |
| 44 | + |
| 45 | + public init(projectedValue: Wrapper<T>) { |
| 46 | + self.wrappedValue = projectedValue.wrappedValue |
| 47 | + } |
| 48 | + |
| 49 | + public var projectedValue: Wrapper<T> { |
| 50 | + get { Wrapper(wrappedValue: wrappedValue) } |
| 51 | + set { wrappedValue = newValue.wrappedValue } |
40 | 52 | }
|
41 | 53 | }
|
42 | 54 |
|
@@ -64,4 +76,22 @@ public struct HasWrappers {
|
64 | 76 | // CHECK-NEXT: _modify
|
65 | 77 | // CHECK-NEXT: }
|
66 | 78 | @WrapperWithInitialValue(alternate: false) public var z
|
| 79 | + |
| 80 | + // CHECK: public func hasParameterWithImplementationWrapper(x: Swift.Int) |
| 81 | + public func hasParameterWithImplementationWrapper(@Wrapper x: Int) { } |
| 82 | + |
| 83 | + // CHECK: public func hasParameterWithImplementationWrapperComposed(x: Swift.Int) |
| 84 | + public func hasParameterWithImplementationWrapperComposed(@Wrapper @ProjectedValueWrapper x: Int) { } |
| 85 | + |
| 86 | + // CHECK: @inlinable public func hasParameterWithImplementationWrapperInlinable(@TestResilient.Wrapper x: Swift.Int) |
| 87 | + @inlinable public func hasParameterWithImplementationWrapperInlinable(@Wrapper x: Int) { } |
| 88 | + |
| 89 | + // CHECK: @_alwaysEmitIntoClient public func hasParameterWithImplementationWrapperAEIC(@TestResilient.Wrapper x: Swift.Int) |
| 90 | + @_alwaysEmitIntoClient public func hasParameterWithImplementationWrapperAEIC(@Wrapper x: Int) { } |
| 91 | + |
| 92 | + // CHECK: public func hasParameterWithAPIWrapper(@TestResilient.ProjectedValueWrapper x: Swift.Int) |
| 93 | + public func hasParameterWithAPIWrapper(@ProjectedValueWrapper x: Int) { } |
| 94 | + |
| 95 | + // CHECK: public func hasParameterWithAPIWrapperComposed(@TestResilient.ProjectedValueWrapper @TestResilient.Wrapper x: Swift.Int) |
| 96 | + public func hasParameterWithAPIWrapperComposed(@ProjectedValueWrapper @Wrapper x: Int) { } |
67 | 97 | }
|
0 commit comments