Skip to content

Add some easy Driver diagnostic messages

Similar in spirit to !5528 (closed). I am trying to add the "easy" diagnostic messages to the codebase without stepping on my own toes, while minimising breakages. Sadly enough for a bunch of these driver messages we don't have a corresponding test case, which we should add. For some of them, it's not clear to me how to write such a test, as driver tests seems a bit complicated to conjure up (but I guess it might be just my impression).

This MR also adds the first message which exposes a list of suggestions to the user, in the returned diagnostic.

I went surprisingly far with the driver messages. Now grepping for UnknownDriverMessage reveals we have only a bunch left:

  • GHC.Driver.MakeFile.findDependency: this one rewraps a cannotFindModule error, which I think belongs to the TcRn realm (as it's used multiple times in the IFace code, and in the TcM monad). Better to back off for now;
  • GHC.Driver.Pipeline.preprocess: This seems like it should genuinely be an UnknownDriverMessage, at least for now;
  • GHC.Driver.Make.noModError: another instance of cannotFindModule.
Edited by Alfredo Di Napoli

Merge request reports