Fix #13839: GHCi warnings do not respect the default module header
Goal: When there is no explicit module header ticket #13839 requests the same unused warning messages for GHC and GHCi when using -Wall.
Remaining difference: If there is no module header and no main function, GHC should still
issue the error The IO action ‘main’ is not defined in module ‘Main’
. However GHCi should not
issue this error and also not show any Defined but not used
warnings.
Changes in compiler/typecheck/TcRnExports.hs:tcRnExports
:
If this is a main module without an explicit module header:
- Remove special check for GHCi.
- If the module has a main function: create a module header to export this main function. This has the effect to mark the main and all top level functions called via main as used .
- Otherwise export all functions. This marks all top level functions as used.
This MR replaces MR 215