Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHarish Yerra
10,031 PointsWhat if the inferred type is a protocol, but there is no implementation in either the original protocol or the extension
Well, the question is pretty much in the title. Game Nadel says that if the inferred type is the protocol then the methods in the protocol's extension are used. However, what if there is no default implementation?
1 Answer
Ivan Kazakov
Courses Plus Student 43,317 PointsYou will get a compile-time error: "value of type 'SomeProtocol' has no member 'someMember'"
Compiler takes type implementation if it is available. If not, it looks for it in a protocol extension. And if it's not implemented there, it just won't compile, which makes perfect sense.
Harish Yerra
10,031 PointsHarish Yerra
10,031 PointsOk, that makes sense. Thanks for clarifying :)