Skip to content

compiler: Rejects RULES whose LHS immediately fails to type-check

This is a bug fix for #24026 (closed): RULES that do not type check causing the compiler to crash when -fdefer-type-errors is used. There is a detailed conversation on #24026 (closed), but to summarize there are two changes.

  • A bug fix on decomposeRuleLhs that fix the fact that coercion variables where being ignored on decomposition.
  • A design choice to ignore rules that don't type-check early on. On normal programs built with no special flags (see T24026b), type-checking fails with the expected error. If for any reason, for example -fdefer-type-errors is used, and the compilation continues, rules that outright don't type check due to LHS failures will be ignored further, the user sees a warning, and GHC does not crash.

Please take a few moments to address the following points:

  • if your MR may break existing programs (e.g. touches base or causes the compiler to reject programs), please describe the expected breakage and add the user-facing label. This will run ghc/head.hackage> to characterise the effect of your change on Hackage.
  • ensure that your commits are either individually buildable or squashed
  • ensure that your commit messages describe what they do (referring to tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places.
  • add a testcase to the testsuite.
  • updates the users guide if applicable
  • mentions new features in the release notes for the next release

If you have any questions don't hesitate to open your merge request and inquire in a comment. If your patch isn't quite done yet please do add prefix your MR title with WIP:.

By default a minimal validation pipeline is run on each merge request, the full-ci label can be applied to perform additional validation checks if your MR affects a more unusual configuration.

Once your change is ready please remove the WIP: tag and wait for review. If no one has offered a review in a few days then please leave a comment mentioning @triagers and apply the Blocked on Review label.

Edited by Simon Peyton Jones

Merge request reports