Fix for Trac #15611: Scope errors lie about what modules are imported.
ClosedPublic

Authored by RolandSenn on Oct 30 2018, 7:54 AM.

Details

Summary

For the error message:

Not in scope X.Y
Module X does not export Y
No module named ‘X’ is imported:

there are 2 cases, where we don't show the last "no module named is imported" line:

  1. If the module X has been imported.
  2. If the module X is the current module. There are 2 subcases:

    2.1 If the unknown module name is in a input source file, then we can use the getModule function to get the current module name.

    2.2 If the unknown module name has been entered by the user in GHCi, then the getModule function returns something like "interactive:Ghci1", and we have to check the current module in the last added entry of the HomePackageTable.
Test Plan

make test TESTS="T15611a T15611b"

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
RolandSenn created this revision.Oct 30 2018, 7:54 AM
RolandSenn edited the summary of this revision. (Show Details)Oct 30 2018, 8:02 AM
DavidEichmann accepted this revision.Oct 31 2018, 5:11 AM

Looks good to me.

This revision is now accepted and ready to land.Oct 31 2018, 5:11 AM
bgamari added a comment.EditedNov 1 2018, 5:34 PM

Also, can you add a note about this to the 8.8 release notes? This is a great feature; it would be a shame if it went unnoticed.

Sigh, wrong Differential.

monoidal accepted this revision.Nov 4 2018, 7:33 AM
This revision was automatically updated to reflect the committed changes.