Avatar
↑この挙動は共通みたい。 === ↓ @objc つけた場合も同じ (edited)
1:49 PM
1> import Foundation 2. 3. @objc protocol P {} 4. class A: P {} 5. class B: P {} 6. 7. func foo<X: P>(_ values: [X]) { 8. print(values.map { "\($0)" }.joined(separator: ", ")) 9. } 10. 11. foo([A(), B()]) error: repl.swift:11:5: error: in argument type '[Any]', 'Any' does not conform to expected type 'P' foo([A(), B()]) ^
1:49 PM
1> import Foundation 2. 3. @objc protocol P {} 4. class A: P {} 5. class B: P {} 6. 7. func foo<X: P>(_ values: [X]) { 8. print(values.map { "\($0)" }.joined(separator: ", ")) 9. } 10. 11. foo([A(), B()] as [P]) __lldb_expr_1.A, __lldb_expr_1.B
1:53 PM
ぱっと見、それっぽいバグレポないなぁ。