Does the following expression evaluate to true? p is AnyObject
If it does then you may have found a bug. On Sun, Dec 4, 2016 at 9:46 PM Charles Srstka via swift-evolution < swift-evolution@swift.org> wrote: > The following currently does not work: > > protocol P: class {} > class C: P {} > > func foo<T>(t: T) where T: AnyObject { > print("foo") > } > > let p: P = C() > > foo(t: p) // error: cannot invoke 'foo' with an argument list of type '(t: > P)' > > It seems to me that this ought to have been allowed, since P is declared > as being a reference type and thus should have been able to satisfy the > function’s requirements. > > Is this worthy of writing a language proposal, or would this be considered > a bug that should be sent through the radar system instead? > > Thanks, > Charles > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution