Avatar
Avatar
koher
おお、↓この挙動もいけた。 @swift-5.7.3 @rethrows protocol P { func foo() throws } @rethrows protocol Q { func bar() throws } struct S1: P { func foo() { print("S1") } } struct S2: P { func foo() throws { print("S2") } } struct T<PType: P>: Q { let p: PType func bar() rethrows { try p.foo() } } T(p: S1()).bar() do { try T(p: S2()).bar() } catch { print(error) }
S1 S2