Try to simplify zoo of functions in `Tc.Utils.Monad`
Fixes #19930 (closed) .
This MR does two things:
It tries to untangle, cleanup and simplify the zoo of diagnostic-related functions in
Tc.Utils.Monadso that we can have the interfaces mention only
TcRnMessages while we push the creation of these messages upstream. To say it differently, prior to this MR we had those functions all take an
SDoc, which was clashing with #18516, which is all about having proper Haskell types as input of these functions. This MR replaces all the
SDocs in those type signature with
As a direct consequence of
TcRnUnknownMessagecropped up everywhere, because those functions in
Tc.Utils.Monadwere constructing a
TcRnUnknownMessagefrom the input
SDoc, but they were doing this very deep in the call stack. This is a good thing! Now it's obvious when a new
TcRnMessageis generated (i.e.
grep TcRnUnknownMessage) and the best part is that we can offload all the porting of these errors to newcomers or eager Haskell developers.