Reject instances for non-classes directly in the renamer
This MR consists of two separate parts:
-
Two commits getting rid of unstructured
SDoc
arguments in error message constructors.Uses of
SDoc
inUnknownSubordinate
andMissingBinding
are replaced with uses of two new structured datatypesSubordinate
(describing possible subordinates e.g. class method, record field etc) andSigLike
(describing signature-like things such as kind signatures, fixity signatures, COMPLETE pragmas, etc).Uses of
SDoc
inHsDocContext
are replaced by new constructors such asClassInstanceCtx
, or by just storing the information we are going to pretty-print instead of the rawSDoc
. This also improves error messages emitted by the renamer. -
The actual fix to #22688 (closed), modifying
rnClsInstDecl
to reject instances for a non-class. In factrnClsInstDecl
already had such logic, but now withlookupGRE
we can do a slightly better job right in the renamer.