Avatar
omochimetaru 10/6/2017 8:04 AM
protocol Eq { func eq(_ x: Self) -> Bool } func f(_ a: Eq, b: Eq) -> Bool { return a.eq(b) } /Users/omochi/work/playground/TempGround.playground:5:13: Protocol 'Eq' can only be used as a generic constraint because it has Self or associated type requirements
8:04 AM
本当だ。
8:05 AM
protocol Eq { func eq1() -> Self func eq2(_ x: Self) } func f(_ a: Eq) { }
8:05 AM
eq1はあってもOK、eq2があるとダメ