Even though I have no associated type
, I get this error:
Protocol can only be used as a generic constraint because it has Self or associated type requirements
The code is as follows. I define a protocol
called Board
, and then, within another protocol
(called Rules
) I create a parameter of type Board
. That's when I get the error.
I have no associated type, so I don't know what the compiler is talking about...
protocol Board : Equatable, Hashable {
init()
var width : Int {get}
var height : Int {get}
}
protocol Rules {
init(board: Board)
}
What on Earth am I doing wrong???