@@ -56,8 +56,11 @@ extension S {
56
56
( self , { $0 } )
57
57
}
58
58
59
+ // Note: qualified name base types are not yet serialized and are not printed
60
+ // when round-tripping.
61
+
59
62
// CHECK: @derivative(of: instanceMethod, wrt: (self, x))
60
- @derivative ( of: instanceMethod, wrt: ( self , x) )
63
+ @derivative ( of: S . instanceMethod, wrt: ( self , x) )
61
64
func derivativeInstanceMethodWrtAll( _ x: S ) -> ( value: S , differential: ( S , S ) -> S ) {
62
65
( self , { ( dself, dx) in self } )
63
66
}
@@ -81,19 +84,39 @@ extension S {
81
84
82
85
extension S {
83
86
var computedProperty : S {
84
- self
87
+ get { self }
88
+ set { }
85
89
}
86
90
87
91
// CHECK: @derivative(of: computedProperty, wrt: self)
88
92
@derivative ( of: computedProperty, wrt: self )
89
93
func derivativeProperty( ) -> ( value: S , differential: ( S ) -> S ) {
90
94
( self , { $0 } )
91
95
}
96
+
97
+ // CHECK: @derivative(of: computedProperty.get, wrt: self)
98
+ @derivative ( of: computedProperty. get, wrt: self )
99
+ func derivativePropertyGetter( ) -> ( value: S , pullback: ( S ) -> S ) {
100
+ fatalError ( )
101
+ }
102
+
103
+ // CHECK: @derivative(of: computedProperty.set, wrt: (self, newValue))
104
+ @derivative ( of: computedProperty. set, wrt: ( self , newValue) )
105
+ mutating func derivativePropertySetter( _ newValue: S ) -> (
106
+ value: ( ) , pullback: ( inout S ) -> S
107
+ ) {
108
+ fatalError ( )
109
+ }
92
110
}
93
111
94
112
// Test subscripts.
95
113
96
114
extension S {
115
+ subscript( ) -> S {
116
+ get { self }
117
+ set { }
118
+ }
119
+
97
120
subscript< T: Differentiable > ( x: T ) -> S {
98
121
self
99
122
}
@@ -103,4 +126,18 @@ extension S {
103
126
func derivativeSubscript< T: Differentiable > ( x: T ) -> ( value: S , differential: ( S ) -> S ) {
104
127
( self , { $0 } )
105
128
}
129
+
130
+ // CHECK: @derivative(of: subscript.get, wrt: self)
131
+ @derivative ( of: subscript. get, wrt: self )
132
+ func derivativeSubscriptGetter( ) -> ( value: S , pullback: ( S ) -> S ) {
133
+ fatalError ( )
134
+ }
135
+
136
+ // CHECK: @derivative(of: subscript.set, wrt: (self, newValue))
137
+ @derivative ( of: subscript. set, wrt: ( self , newValue) )
138
+ mutating func derivativeSubscriptSetter( _ newValue: S ) -> (
139
+ value: ( ) , pullback: ( inout S ) -> S
140
+ ) {
141
+ fatalError ( )
142
+ }
106
143
}
0 commit comments