Opened 8 years ago

Closed 8 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: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Here is an error message from 6.11:

    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 8 years ago.
Source file leading to error message with bad line number

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by nr

Attachment: ZDF5ex.hs added

Source file leading to error message with bad line number

comment:1 Changed 8 years ago by igloo

difficulty: Unknown
Milestone: 6.12 branch

Thanks for the report.

comment:2 Changed 8 years ago by simonpj

Resolution: fixed
Status: newclosed

I'm nearly certain I have fixed this bug:

Wed Jul 22 23:55:04 PDT 2009
  * 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


Note: See TracTickets for help on using tickets.