Avatar
type がwitness tableに載っていないのでtypeメソッドの呼び出しが全部静的になってますねー
11:46 AM
@swift-5.2.5 protocol SomeProtocol { func type() -> String } extension Int: SomeProtocol {} extension SomeProtocol { func toOpaque() -> some SomeProtocol { return 1 } func toProtocol() -> SomeProtocol { return 1 } } extension SomeProtocol { func type() -> String { return "protocol" } } extension Int { func type() -> String { return "int" } } let a = 1.toOpaque() let b = 1.toProtocol() print(type(of: a)) print(type(of: b)) print(a.type()) print(b.type())