#5868: Wrong error messages with qualified imports
---------------------------------+------------------------------------------
    Reporter:  SimonHengel       |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:  _|_             
   Component:  Compiler          |     Version:  7.4.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * difficulty:  => Unknown
  * milestone:  => _|_


Comment:

 Correct.

 By the time we get to the type checker, GHC has forgotten ''how'' the
 entity was referenced and has simply recorded ''what'' entity was
 referenced. In this case it knows that you are talking about "the `bar`
 defined in module `Bar`", but has forgotten what you called it.   Then
 when it prints the error message it tries to find some unambiguous name
 for it; hence the result.

 It isn't perfect I grant you.  One way to improve matters might be to
 change the `HsExpr` data type a bit, so instead of
 {{{
 data HsExpr id = HsVar     id
                 | ...
 }}}
 we have
 {{{
 data HsExpr id = HsVar     id RdrName
                 | ...
 }}}
 so that every `HsVar` remembers how it was originally specified.  That
 would catch 90% of the cases, but I worry about the others (eg qualified
 use of data constructors in patterns).  A more thorough solution might be
 to make the renamer produce `HsExpr (Name, RdrName)` rather than `HsExpr
 Name`.  But it's also pretty expensive.

 My gut feel is to let sleeping dogs lie unless more people pipe up that
 this is really painful.

 Simon

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to