[GHC] #11071: "Not in scope" errors should be more informative for qualified names.

GHC ghc-devs at haskell.org
Tue Nov 10 16:05:50 UTC 2015


#11071: "Not in scope" errors should be more informative for qualified names.
-------------------------------------+-------------------------------------
        Reporter:  mojojojo          |                Owner:  nomeata
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by nomeata):

 * owner:   => nomeata


Old description:

> E.g., if I have something like `Maybe.maybeToList` in a module, which
> does not have such an import, I get the following error:
>
>     Not in scope: ‘Maybe.maybeToList’
>
> Which leads the user to conclude that the `Maybe` namespace does not
> contain the `maybeToList` element, instead of informing that the `Maybe`
> namespace is not imported altogether instead.

New description:

 E.g., if I have something like `Maybe.maybeToList` in a module, which does
 not have such an import, I get the following error:

     Not in scope: ‘Maybe.maybeToList’

 Which leads the user to conclude that the `Maybe` namespace does not
 contain the `maybeToList` element, instead of informing that the `Maybe`
 namespace is not imported altogether instead

--

Comment:

 Looking at the code right now. The first case (`No Module named Maybe is
 imported.`) is pretty easy. The other cases are actually quite tricky. The
 semantics of import lists is rather involved, and the code in
 `filterImports` in `RnNames` is quite terse. Maybe it is better to simply
 remember the `mi_exports` of all modules, look up the name there, and if
 it is found, then conclude that it was the fault of the import list.

 OTOH, a perfect solution would actually suggest to add `D3` to the
 `C(D1,D2,D3)` in `import Foo (C(D1,D2))` if a data constructor `Foo.D3` is
 out of scope.

 I’ll see how far I get...

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11071#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list