Consider that we have two modules, A and B, both with hs-boot files,
- A.hs contains a SOURCE import of B
- B.hs-boot contains a SOURCE import of A
- A.hs-boot declares an orphan instance
- A.hs defines the orphan instance
In this case, B's dep_orphs will contain A due to its SOURCE import of A.
Consequently, A will contain itself in its imp_orphs due to its import of B.
This fact would end up being recorded in A's interface file. This would then
break the invariant asserted by calculateAvails that a module does not itself in
its dep_orphs. This was the cause of Trac #14128.
The solution is to remove self-references from imp_orphs when constructing
dep_orphs; we already did a similar thing for dep_mods. I believe we should do
the same for dep_finsts, although I'm treating this as a separate bug.