Opened 6 years ago

Closed 6 years ago

#3193 closed bug (fixed)

line number for GADT type error is very inaccurate

Reported by: nr Owned by:
Priority: normal Milestone: 6.12 branch
Component: Compiler Version: 6.11
Keywords: GADTs Cc:
Operating System: Linux Architecture: x86
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Here is an error message from 6.11:

cmm/ZDF5ex.hs:528:2:
    Couldn't match expected type `ZOpen'
           against inferred type `ZClosed'
      Expected type: ZipGF m l e x
      Inferred type: ZipGF m l C O
    In the first argument of `anal_f', namely `g'
    In the expression: anal_f g (return . fromZJust) ZNothing

This is all very well, but the offending term (the one shown in the message) is actually on line 697, not line 528. The term is part of one declaration in a monster 'where' clause attached to the definition on line 528, column 2. The next one might not be so easy to find.

I'm attaching the file, which is part of some new GHC code I'm hoping to deliver one of these months. If you need access to the whole thing I'll have a branch in a git repository.

Attachments (1)

ZDF5ex.hs (56.4 KB) - added by nr 6 years ago.
Source file leading to error message with bad line number

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by nr

Source file leading to error message with bad line number

comment:1 Changed 6 years ago by igloo

  • difficulty set to Unknown
  • Milestone set to 6.12 branch

Thanks for the report.

comment:2 Changed 6 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed

I'm nearly certain I have fixed this bug:

Wed Jul 22 23:55:04 PDT 2009  [email protected]
  * Fix Trac #3193: improve line number reporting for equality constraints
  Ignore-this: b45a68071bcaca48cad7855dccb9c9eb
  
  When reporting an error from a failed equality constraint, we were
  setting the *context* but not the *line number* in TcTyFuns.eqInstMisMatch
  As a result, the line number didn't match the context at all.  It's
  trivial to fix.
  
  I'm 99% certain this fixes #3193, but it's too complicated to
  reproduce, so I have not actually tested it.
  

    M ./compiler/typecheck/TcRnMonad.lhs -3 +3
    M ./compiler/typecheck/TcSimplify.lhs -2 +2
    M ./compiler/typecheck/TcTyFuns.lhs -2 +1

Simon

Note: See TracTickets for help on using tickets.