The following code gives me an error on line return p.foo(self)
. The error says: \'P\' does not have a member named \'foo\'
.
protocol P
You never required that the two T
s match. They are each in their own scope. Therefore the compiler looks for a foo
function with the wrong parameter types.
I believe something like this would be correct:
protocol P {
typealias T
func foo(c: C) -> T
func foo2() -> T
}
class C {
var p: ConcreteP
init (p: ConcreteP) {
self.p = p
}
func bar() -> T {
return p.foo(self);
}
}
At least I don't get any syntax errors. However on compilation I get:
error: unimplemented IR generation feature non-fixed class layout
var p: ConcreteP
^
LLVM ERROR: unimplemented IRGen feature! non-fixed class layout
That sounds like a compiler bug.