Opened 6 years ago

Closed 3 years ago

#6098 closed bug (fixed)

debugger does not know the correct type for a newtype field

Reported by: phercek Owned by:
Priority: normal Milestone:
Component: GHCi Version: 7.4.2
Keywords: debugger bindings Cc: hvr
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This bug is in 7.4.1. I think it was also in 7.0.3. It is also in the current head:
commit 921530b477867edb5158e4ad5bbbdb5c7c531c97
Date: Tue May 15 10:32:58 2012 +0100

Here is the console log. Notice that the type of allItems is resolved as TWrapper but it should be [Int]. Expressions in conditional breakpoints are failing because of this.

18:06 tm=3:2 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1035> cat bindings-bug.hs
newtype TWrapper = Wrapper
  { mItems :: [Int]
  } deriving Show

main = print $ test $ Wrapper [1]

test Wrapper{ mItems = allItems } = id $
  let headItem = head allItems in

18:06 tm=0 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1036> ../../ghc/stage2/build/tmp/ghc-stage2 -B. --interactive bindings-bug.hs
GHCi, version 7.5.20120515:  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( bindings-bug.hs, interpreted )
Ok, modules loaded: Main.
*Main> :break 7 37
Breakpoint 0 activated at bindings-bug.hs:(7,37)-(9,10)
*Main> :main 
Stopped at bindings-bug.hs:(7,37)-(9,10)
_result :: Int = _
allItems :: TWrapper = _
[bindings-bug.hs:(7,37)-(9,10)] *Main> :list
7  test Wrapper{ mItems = allItems } = id $
8    let headItem = head allItems in
9    headItem
[bindings-bug.hs:(7,37)-(9,10)] *Main> head allItems

    Couldn't match expected type `[a0]' with actual type `TWrapper'
    In the first argument of `head', namely `allItems'
    In the expression: head allItems
    In an equation for `it': it = head allItems
[bindings-bug.hs:(7,37)-(9,10)] *Main> :continue 
*Main> :quit 
Leaving GHCi.
18:06 tm=42 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib

Attachments (1)

bindings-bug.hs (188 bytes) - added by phercek 6 years ago.
the example file

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by phercek

Attachment: bindings-bug.hs added

the example file

comment:1 Changed 6 years ago by simonmar

difficulty: Unknown
Milestone: 7.6.1
Priority: normalhigh

Thanks for the report, we'll take a look.

comment:2 Changed 5 years ago by igloo


comment:3 Changed 5 years ago by igloo


comment:4 Changed 4 years ago by ptc

Owner: set to ptc

Going to try to take a look at this.

(I can't promise I'll try, but I'll try to try)

comment:5 Changed 4 years ago by thoughtpolice

Cc: hvr added
Owner: ptc deleted
Priority: highnormal

Moving out to 7.10.1

comment:6 Changed 3 years ago by thomie

Architecture: x86_64 (amd64)Unknown/Multiple
Milestone: 7.10.1
Operating System: LinuxUnknown/Multiple
Resolution: fixed
Status: newclosed

This was fixed in the 7.8.1 release.

Note: See TracTickets for help on using tickets.