Warning on name collisions with functions in protocol extensions

(Brian King) #1

Has there been any conversation around generating a warning if a type
implements a function that is also implemented in an extension of a
conforming protocol? This is a frequent source of confusion for new swift
developers, and I think the reaction to this behavior is more severe than
it needs to be because the compiler does not help identify or explain the

My gut feeling is that intended (or required) function collisions are very
rare. I think forcing the user to rename the colliding function would work
most of the time. The language could have an attribute like
`@iMeantToCollideFunctions` to disable the warning when it was intended,
although no good name for this attribute comes to mind. It feels like there
needs to be some way to disable the warning when the collision is accepted,
even if it is a rare use case. Colliding functions could also be not
supported, just like conforming to 2 protocols with colliding default

Anyway, I'm not sure if this has been discussed and dismissed already. I've
been having fun exploring compiler warnings to help developers avoid
dispatch confusion, and was interested in what people thought.

Brian King