@@ -164,6 +164,8 @@ struct SubscriptArity {
164
164
// Throws effect checking
165
165
//
166
166
167
+ enum MyError : Error { }
168
+
167
169
@abi ( func throws00( _: ( ) throws -> Void) )
168
170
func throws00( _: ( ) throws -> Void ) { }
169
171
@@ -173,6 +175,9 @@ func throws10(_: () throws -> Void) {}
173
175
@abi( func throw s20 ( _: ( ) throws -> Void) rethrows) // expected-error {{cannot give 'throws20' the ABI of a global function which can throw}}
174
176
func throw s20 ( _: ( ) throws -> Void) { }
175
177
178
+ @abi( func throw s30 ( _: ( ) throws -> Void) throws( MyError) ) // expected-error {{cannot give 'throws30' the ABI of a global function which can throw}}
179
+ func throw s30 ( _: ( ) throws -> Void) { }
180
+
176
181
@abi( func throw s01 ( _: ( ) throws -> Void) ) // expected-error {{cannot give 'throws01' the ABI of a global function which cannot throw}}
177
182
func throw s01 ( _: ( ) throws -> Void) throws { }
178
183
@@ -182,6 +187,9 @@ func throws11(_: () throws -> Void) throws {}
182
187
@abi ( func throws21( _: ( ) throws -> Void) rethrows)
183
188
func throw s21 ( _: ( ) throws -> Void) throws { }
184
189
190
+ @abi ( func throws31( _: ( ) throws -> Void) throws( MyError) ) // expected-error {{thrown type 'MyError' in '@abi' should match 'any Error'}}
191
+ func throw s31 ( _: ( ) throws -> Void) throws { } // expected-note@:37 {{should match type here}}
192
+
185
193
@abi ( func throws02( _: ( ) throws -> Void) ) // expected-error {{cannot give 'throws02' the ABI of a global function which cannot throw}}
186
194
func throw s02 ( _: ( ) throws -> Void) rethrows { }
187
195
@@ -191,6 +199,21 @@ func throws12(_: () throws -> Void) rethrows {}
191
199
@abi ( func throws22( _: ( ) throws -> Void) rethrows)
192
200
func throw s22 ( _: ( ) throws -> Void) rethrows { }
193
201
202
+ @abi ( func throws32( _: ( ) throws -> Void) throws( MyError) ) // expected-error {{thrown type 'MyError' in '@abi' should match 'any Error'}}
203
+ func throw s32 ( _: ( ) throws -> Void) rethrows { } // expected-note@:37 {{should match type here}}
204
+
205
+ @abi ( func throws03( _: ( ) throws -> Void) ) // expected-error {{cannot give 'throws03' the ABI of a global function which cannot throw}}
206
+ func throw s03 ( _: ( ) throws -> Void) throws( MyError) { }
207
+
208
+ @abi ( func throws13( _: ( ) throws -> Void) throws) // expected-error {{thrown type 'any Error' in '@abi' should match 'MyError'}}
209
+ func throw s13 ( _: ( ) throws -> Void) throws( MyError) { } // expected-note@:37 {{should match type here}}
210
+
211
+ @abi ( func throws23( _: ( ) throws -> Void) rethrows) // expected-error {{thrown type 'any Error' in '@abi' should match 'MyError'}}
212
+ func throw s23 ( _: ( ) throws -> Void) throws( MyError) { } // expected-note@:37 {{should match type here}}
213
+
214
+ @abi ( func throws33( _: ( ) throws -> Void) throws( MyError) )
215
+ func throw s33 ( _: ( ) throws -> Void) throws( MyError) { }
216
+
194
217
@abi ( var throws00Var: Int)
195
218
var throw s00 Var: Int { get { fatalError ( ) } }
196
219
0 commit comments