Hello community! I' wondering if somebody can explain this to me.
Please take look at the snippet.
protocol P {}
struct X:P {}
func foo<A:P>(_ x:A) {}
func bar() {
//let x = X() // this compiles
let x = X() as P // this does not compile. Why?
foo(x)
}
I expect the both cases to work though. But only first works? And I do not
understand why.
My coworkers said that it is a compiler bug, but I'm not shure it is.
Thanks for the help.
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users