Opened 13 years ago

Closed 2 years ago

#597 closed task (fixed)

Various error messages have inaccurate source locations

Reported by: simonmar Owned by:
Priority: low Milestone:
Component: Compiler Version: None
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: #10768 Differential Rev(s):
Wiki Page:

Description (last modified by igloo)

Some error messages lack source location information, or have inaccurate locations. Here are the ones we know about:

  • Should point to the import decl:
       ShowFunctions.hs:1:0
         Warning: Module `Text.Show.Functions' is imported, but nothing from it is used
    
  • Should point to the instance header:
       mod41.hs:3:0:
           Illegal instance declaration for `Eq (Either a a)'
             (The instance type must be of form (T a b c)
    
  • Should point to 'deriving *Eq*', not the tycon:
       tcfail046.hs:9:8:
         No instance for `Eq (Pid -> Time -> Message a -> (MessList a, Continuation a
    ))'
         When deriving the `Eq' instance for type `Continuation'
    
  • check_tau_type doesn't have location info?
       tcfail100.hs:7:0:
           Type synonym `A' should have 1 argument, but has been given 0
           In the type synonym declaration for `B'
    
  • Location in LHsModule from the parser should really span the whole file, rather than a point span at (1,0).
  • read016: should be the lhs only?
  • tcfail044: should be the instance head only.

Change History (11)

comment:1 Changed 12 years ago by simonmar

Architecture: Unknown
Description: modified (diff)
difficulty: Moderate (1 day)
Operating System: Unknown

comment:2 Changed 11 years ago by igloo

Description: modified (diff)
Milestone: 6.8

comment:3 Changed 10 years ago by simonmar

Priority: normallow

comment:4 Changed 10 years ago by igloo

Milestone: 6.8 branch_|_

comment:5 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:6 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:7 Changed 8 years ago by simonmar

difficulty: Moderate (1 day)Moderate (less than a day)

comment:8 Changed 8 years ago by igloo

Description: modified (diff)
Type of failure: None/Unknown

comment:9 Changed 8 years ago by igloo

Type of failure: None/UnknownOther

Note that to get the full span, rather than just the start, you need to use the -ferror-spans flag. I don't know why that isn't the default.

In 6.13:

  • 1 is fixed
  • 2 is not fixed points to the entire instance declaration
  • 3 is fixed; it points to "Eq"
  • 4 is not fixed; it points to the whole type declaration, not just "A"
  • 5 is not fixed; see fileSrcSpan in Parser.y.pp
  • 6 is not fixed (note that the test is now readFail016)
  • 7 is not fixed points to the entire instance declaration (same as 2?)

comment:10 Changed 8 years ago by simonpj

I believe that all are fixed now except 5, which I don't know how to do:

  • Location in LHsModule from the parser should really span the whole file, rather than a point span at (1,0)

Two patches:

Thu Jan  7 07:11:13 PST 2010  simonpj@microsoft.com
  * A little refactoring, plus improve error locations
  
  Fixes some sub-items of Trac #597

    M ./compiler/typecheck/TcDeriv.lhs -2 +1
    M ./compiler/typecheck/TcInstDcls.lhs -2 +1
    M ./compiler/typecheck/TcMType.lhs -6 +17

and

Thu Jan  7 07:32:34 PST 2010  simonpj@microsoft.com
  * Improve error locations
  
  More on Trac #597

    M ./compiler/rename/RnBinds.lhs -21 +20
    M ./compiler/rename/RnTypes.lhs -9 +9

Simon

comment:11 Changed 2 years ago by bgamari

Resolution: Nonefixed
Status: newclosed

Closing as all but one of these issues have been resolved. The remaining issue will be tracked by #10768.

Note: See TracTickets for help on using tickets.