Avatar
Avatar
koher
@swift-main protocol View { } struct FooView: View { } struct BarView: View { } struct TupleView<T>: View { let content: T init(_ content: T) { self.content = content } } func buildBlock<C0, C1>(_ c0: C0, _ c1: C1) -> TupleView<(C0, C1)> where C0 : View, C1 : View { TupleView((c0, c1)) } let view0: any View = FooView() let view1: any View = BarView() print(buildBlock(view0, view1))
swiftNightly BOT 6/3/2022 2:40 AM
exit status: 1 with stderr:<stdin>:23:7: error: type 'any View' cannot conform to 'View' print(buildBlock(view0, view1)) ^ <stdin>:23:7: note: only concrete types such as structs, enums and classes can conform to protocols print(buildBlock(view0, view1)) ^ <stdin>:17:6: note: required by global function 'buildBlock' where 'C0' = 'any View' func buildBlock<C0, C1>(_ c0: C0, _ c1: C1) -> TupleView<(C0, C1)> where C0 : View, C1 : View { ^ <stdin>:23:7: error: type 'any View' cannot conform to 'View' print(buildBlock(view0, view1)) ^ <stdin>:23:7: note: only concrete types such as structs, enums and classes can conform to protocols print(buildBlock(view0, view1)) ^ <stdin>:17:6: note: required by global function 'buildBlock' where 'C1' = 'any View' func buildBlock<C0, C1>(_ c0: C0, _ c1: C1) -> TupleView<(C0, C1)> where C0 : View, C1 : View { ^