[commit: ghc] master: Fix for Trac #15611: Scope errors lie about what modules are imported. (1a3b9bd)

git at git.haskell.org git at git.haskell.org
Sun Nov 4 16:56:14 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1a3b9bd0b674ad16a41b942c738b8f34564bcd8d/ghc

>---------------------------------------------------------------

commit 1a3b9bd0b674ad16a41b942c738b8f34564bcd8d
Author: roland <rsx at bluewin.ch>
Date:   Sun Nov 4 16:45:29 2018 +0100

    Fix for Trac #15611: Scope errors lie about what modules are imported.
    
    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"
    
    Reviewers: monoidal, hvr, thomie, dfeuer, bgamari, DavidEichmann
    
    Reviewed By: monoidal, DavidEichmann
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15611
    
    Differential Revision: https://phabricator.haskell.org/D5284


>---------------------------------------------------------------

1a3b9bd0b674ad16a41b942c738b8f34564bcd8d
 compiler/rename/RnUnbound.hs                       | 53 +++++++++++++++++++---
 compiler/typecheck/TcErrors.hs                     |  4 +-
 testsuite/tests/module/mod62.stderr                |  1 -
 testsuite/tests/rename/should_fail/T15611a.hs      |  2 +
 testsuite/tests/rename/should_fail/T15611a.stderr  |  1 +
 testsuite/tests/rename/should_fail/T15611b.hs      |  1 +
 testsuite/tests/rename/should_fail/T15611b.script  |  2 +
 testsuite/tests/rename/should_fail/T15611b.stderr  |  1 +
 testsuite/tests/rename/should_fail/T5892b.stderr   |  4 +-
 testsuite/tests/rename/should_fail/all.T           |  2 +
 .../tests/rename/should_fail/rnfail034.stderr      |  1 -
 11 files changed, 60 insertions(+), 12 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1a3b9bd0b674ad16a41b942c738b8f34564bcd8d


More information about the ghc-commits mailing list