@@ -313,10 +313,50 @@ struct UntypedRes<Success>: P {
313
313
}
314
314
315
315
struct InfallibleRes < Success> : P {
316
- // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s20typed_throws_generic13InfallibleResVyxGAA1PA2aEP1fyy1EQzYKFTW : $@convention(witness_method: P) <τ_0_0> (@in_guaranteed InfallibleRes<τ_0_0>) -> @error_indirect τ_0_0.E
317
- // CHECK: bb0(%0 : $*@error_type τ_0_0.E , %1 : $*InfallibleRes<τ_0_0>):
316
+ // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s20typed_throws_generic13InfallibleResVyxGAA1PA2aEP1fyy1EQzYKFTW : $@convention(witness_method: P) <τ_0_0> (@in_guaranteed InfallibleRes<τ_0_0>) -> @error_indirect Never
317
+ // CHECK: bb0(%0 : $*Never , %1 : $*InfallibleRes<τ_0_0>):
318
318
// CHECK: [[SELF:%.*]] = load [trivial] %1 : $*InfallibleRes<τ_0_0>
319
319
// CHECK: [[WITNESS:%.*]] = function_ref @$s20typed_throws_generic13InfallibleResV1fyyF : $@convention(method) <τ_0_0> (InfallibleRes<τ_0_0>) -> ()
320
320
// CHECK: = apply [[WITNESS]]<τ_0_0>([[SELF]]) : $@convention(method) <τ_0_0> (InfallibleRes<τ_0_0>)
321
321
func f( ) { }
322
322
}
323
+
324
+ // Protocol with a default implementation of its function with a
325
+ // thrown error type.
326
+ protocol P2 {
327
+ associatedtype Failure : Error
328
+ func f( ) throws ( Failure)
329
+ }
330
+
331
+ extension P2 {
332
+ func f( ) throws ( Failure) { }
333
+ }
334
+
335
+ // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s20typed_throws_generic1SVAA2P2A2aDP1fyy7FailureQzYKFTW : $@convention(witness_method: P2) (@in_guaranteed S) -> @error_indirect Never
336
+ // CHECK: bb0(%0 : $*Never, %1 : $*S)
337
+ struct S : P2 {
338
+ typealias Failure = Never
339
+ }
340
+
341
+ // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s20typed_throws_generic2GSVyxGAA2P2A2aEP1fyy7FailureQzYKFTW : $@convention(witness_method: P2) <τ_0_0> (@in_guaranteed GS<τ_0_0>) -> @error_indirect Never {
342
+ // CHECK: bb0(%0 : $*Never, %1 : $*GS<τ_0_0>):
343
+ struct GS < T> : P2 {
344
+ typealias Failure = Never
345
+ }
346
+
347
+ // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s20typed_throws_generic3GSFVyxq_GAA2P2A2aEP1fyy7FailureQzYKFTW : $@convention(witness_method: P2) <τ_0_0, τ_0_1 where τ_0_1 : Error> (@in_guaranteed GSF<τ_0_0, τ_0_1>) -> @error_indirect τ_0_1 {
348
+ // CHECK: bb0(%0 : $*τ_0_1, %1 : $*GSF<τ_0_0, τ_0_1>):
349
+ struct GSF < T, Failure: Error > : P2 {
350
+ }
351
+
352
+ // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s20typed_throws_generic4GSF2Vyxq_GAA2P2A2aEP1fyy7FailureQzYKFTW : $@convention(witness_method: P2) <τ_0_0, τ_0_1 where τ_0_0 : Error> (@in_guaranteed GSF2<τ_0_0, τ_0_1>) -> @error_indirect τ_0_0 {
353
+ // CHECK: bb0(%0 : $*τ_0_0, %1 : $*GSF2<τ_0_0, τ_0_1>):
354
+ struct GSF2 < F: Error , T> : P2 {
355
+ typealias Failure = F
356
+ }
357
+
358
+ // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s20typed_throws_generic3GSAVyxGAA2P2A2aEP1fyy7FailureQzYKFTW : $@convention(witness_method: P2) <τ_0_0> (@in_guaranteed GSA<τ_0_0>) -> @error_indirect any Error {
359
+ // CHECK: bb0(%0 : $*any Error, %1 : $*GSA<τ_0_0>):
360
+ struct GSA < T> : P2 {
361
+ typealias Failure = any Error
362
+ }
0 commit comments