Fixes #19930 (closed) .
This MR does two things:
It tries to untangle, cleanup and simplify the zoo of diagnostic-related functions in
Tc.Utils.Monad so 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
TcRnUnknownMessage cropped up everywhere, because those functions in
were constructing a
TcRnUnknownMessage from 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
TcRnMessage is 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.