Skip to content

Reject instances for non-classes directly in the renamer

sheaf requested to merge sheaf/ghc:T22688 into master

This MR consists of two separate parts:

  1. Two commits getting rid of unstructured SDoc arguments in error message constructors.

    Uses of SDoc in UnknownSubordinate and MissingBinding are replaced with uses of two new structured datatypes Subordinate (describing possible subordinates e.g. class method, record field etc) and SigLike (describing signature-like things such as kind signatures, fixity signatures, COMPLETE pragmas, etc).

    Uses of SDoc in HsDocContext are replaced by new constructors such as ClassInstanceCtx, or by just storing the information we are going to pretty-print instead of the raw SDoc. This also improves error messages emitted by the renamer.

  2. The actual fix to #22688 (closed), modifying rnClsInstDecl to reject instances for a non-class. In fact rnClsInstDecl already had such logic, but now with lookupGRE we can do a slightly better job right in the renamer.

Edited by sheaf

Merge request reports

Loading