Fix errors caused by invalid candidates leaking from hole fits

Authored by Tritlo on Wed, Jul 4, 6:54 AM.

Description

Fix errors caused by invalid candidates leaking from hole fits

This is a one line fix (and a note) that fixes four tickets, Trac #15007,
Trac #15321 and Trac #15202, Trac #15314

The issue was that errors caused by illegal candidates (according to GHC
stage or being internal names) were leaking to the user, causing
bewildering error messages. If a candidate causes the type checker to
error, it is not a valid hole fit, and should be discarded.

As mentioned in Trac #15321, this can cause a pattern of omissions, which
might be hard to discover. A better approach would be to gather the
error messages, and ask users to report them as GHC bugs. This will be
implemented in a subsequent change.

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: Trac #15007, Trac #15321, Trac #15202, Trac #15314

Differential Revision: https://phabricator.haskell.org/D4909

(cherry picked from commit 39de4e3d33dd9879398062620ad00b1e3b8481ce)