You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Let's say we want to add a default implementation of the method cook() to every Human who also has a parent (conforming to HasParent protocol), but only if the parent can cook (Parent conforming to CanCook protocol).
3. Lastly, let's have two classes that implement these protocols, one of them who implements the method cook() and another that has a parent, that we want to delegate the call to:
Note that if we change the type of parent in Toddler to Father, it works as expected. As well as changing the type of parent in Toddler to CanCook and changing the extension definition so that the conformance states Self.Parent == CanCook instead of Self.Parent: CanCook.
The text was updated successfully, but these errors were encountered:
Environment
Xcode 10.2.1
Swift 5.0.1
macOS 10.14.5
Additional Detail from JIRA
md5: b02c78ec857e720ea4ad9f1e15a47204
relates to:
Issue Description:
1. Let's declare three protocols Human, HasParent and CanCook:
2. Let's say we want to add a default implementation of the method cook() to every Human who also has a parent (conforming to HasParent protocol), but only if the parent can cook (Parent conforming to CanCook protocol).
3. Lastly, let's have two classes that implement these protocols, one of them who implements the method cook() and another that has a parent, that we want to delegate the call to:
Expected result would be that when calling cook() on the Toddler class, the parent.cook() would get called.
Actual result is compile error:
Note that if we change the type of parent in Toddler to Father, it works as expected. As well as changing the type of parent in Toddler to CanCook and changing the extension definition so that the conformance states Self.Parent == CanCook instead of Self.Parent: CanCook.
The text was updated successfully, but these errors were encountered: