Fix and enforce validation of header for .hie files

Merged Zubin requested to merge wz1000/ghc:hiefile-header into master

Implements the changes described in #16686 (closed)

Please take a few moments to verify that your commits fulfill the following:

  • are either individually buildable or squashed
  • have commit messages which describe what they do (referring to [Notes][notes] and tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a [Note][notes] and cross-reference it from the relevant places.
  • add a testcase to the testsuite.

Merge request reports