[swift-dev] Descriptive Protocol non-conformance errors

Douglas Gregor dgregor at apple.com
Wed Jul 6 22:24:51 CDT 2016

> On Jun 25, 2016, at 1:19 PM, Sean Alling via swift-dev <swift-dev at swift.org> wrote:
> Hi everyone,
> I’m suggesting a change to the compiler that returns an error when an object 'does not conform to protocol’ to nest sub-errors that’ll list what properties and methods the object hasn’t implemented.
> I’m using the idea of a nested error so that the exceptions thrown will be grouped when shown. That was each doesn’t create a new error, racking up the error count, but rather just showing the developer the things he/she needs to implement.

I would *love* for us to have errors with Fix-Its that put in stub declarations for what you need to implement to conform to the protocol. I don’t think you should use sub-errors, though, because the structure doesn’t always come across well in IDEs. Rather, I’d suggest emitting one error per missing requirement, with a Fix-It that adds the proper declaration into the type/extension that declared conformance, and a note pointing to the requirement itself.

	- Doug

More information about the swift-dev mailing list