Opened 9 years ago

Closed 8 years ago

#5048 closed bug (fixed)

Wrong SrcSpan on AbsBinds

Reported by: JPMoresmau Owned by:
Priority: normal Milestone: 7.2.1
Component: GHC API Version: 7.0.2
Keywords: SrcSpan Cc:
Operating System: Windows Architecture: x86
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

I have the following code:

{-# LANGUAGE RankNTypes #-}

module Folder1.ForAll where

import Data.Char

fun ::  t -> [Char] -> [Char]
fun _=reverse . map toUpper

And the TypecheckedSource gives me something like (using the ghc-syb-utils package to dump it:)

{Bag(Located (HsBind Var)):
  (L {src\Folder1\ForAll.hs:8:1-29}
    [{Var: t}]
      [{Var: t}] {Var:} {Var: fun}
    ({abstract:TcEvBinds}) {Bag(Located (HsBind Var)):
     (L {src\Folder1\ForAll.hs:9:1-27}
       (L {src\Folder1\ForAll.hs:9:1-3} {Var: fun})

The issue here is that the AbsBinds has a SrcSpan that only covers the type signature, and not the rest of the code, hence (I think) we never go down the contents, and Scion cannot resolve anything when a user asks it to. If the type signature is not present, the problem doesn't occur: the AbsBinds location covers all the source code. If the type signature is present but without any type variable, there is no AbsBinds and no problem (the FunBind covers all the code).

Change History (3)

comment:1 Changed 9 years ago by simonpj

Description: modified (diff)
Status: newinfoneeded

I think this should fix it

Thu Mar 31 11:23:15 BST 2011
  * Fix Trac #5048: location on AbsBinds
  This patch just puts a better SrcSpan on the AbsBinds
  produced by the type checker

    M ./compiler/basicTypes/SrcLoc.lhs -13 +11
    M ./compiler/typecheck/TcBinds.lhs -4 +6

No one had ever looked at that SrcSpan before!

Can you try now, and close if ok?


comment:2 Changed 9 years ago by igloo

Milestone: 7.2.1

comment:3 Changed 8 years ago by igloo

Resolution: fixed
Status: infoneededclosed

No response from submitter, so assuming it's fixed.

Note: See TracTickets for help on using tickets.