Hello,
I'm trying to use conditional conformance on a generic object, it works but when I inherit from the generic class, it seems to be losing the conditional conformance.
Any idea what I might be doing wrong here?
protocol Tasty { }
protocol Juicy { }
struct Peach: Tasty, Juicy { }
protocol Juiceable { }
class Foo<C> where C: Tasty {
var whatAmI: String {
if self is Juiceable {
return "Is Juiceable"
} else {
return "Not Juiceable"
}
}
}
extension Foo: Juiceable where C: Juicy { }
class MegaFoo: Foo<Peach> { }
let megaFoo = MegaFoo()
megaFoo.whatAmI // Not Juiceable
let foo = Foo<Peach>()
foo.whatAmI // Juiceable