Opened 11 years ago

Last modified 5 years ago

#597 new task (None)

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: Differential Revisions:

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 (10)

comment:1 Changed 9 years ago by simonmar

  • Architecture set to Unknown
  • Description modified (diff)
  • difficulty set to Moderate (1 day)
  • Operating System set to Unknown

comment:2 Changed 9 years ago by igloo

  • Description modified (diff)
  • Milestone set to 6.8

comment:3 Changed 8 years ago by simonmar

  • Priority changed from normal to low

comment:4 Changed 7 years ago by igloo

  • Milestone changed from 6.8 branch to _|_

comment:5 Changed 7 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:6 Changed 7 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:7 Changed 5 years ago by simonmar

  • difficulty changed from Moderate (1 day) to Moderate (less than a day)

comment:8 Changed 5 years ago by igloo

  • Description modified (diff)
  • Type of failure set to None/Unknown

comment:9 Changed 5 years ago by igloo

  • Type of failure changed from None/Unknown to Other

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 5 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  [email protected]
  * 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  [email protected]
  * Improve error locations
  
  More on Trac #597

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

Simon

Note: See TracTickets for help on using tickets.