Opened 5 years ago

Closed 2 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 5 years ago.
the example file

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by phercek

the example file

comment:1 Changed 5 years ago by simonmar

  • difficulty set to Unknown
  • Milestone set to 7.6.1
  • Priority changed from normal to high

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

comment:2 Changed 4 years ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:3 Changed 4 years ago by igloo

  • Milestone changed from 7.6.2 to 7.8.1

comment:4 Changed 3 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 3 years ago by thoughtpolice

  • Cc hvr added
  • Milestone changed from 7.8.3 to 7.10.1
  • Owner ptc deleted
  • Priority changed from high to normal

Moving out to 7.10.1

comment:6 Changed 2 years ago by thomie

  • Architecture changed from x86_64 (amd64) to Unknown/Multiple
  • Milestone 7.10.1 deleted
  • Operating System changed from Linux to Unknown/Multiple
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from 7.5 to 7.4.2

This was fixed in the 7.8.1 release.

Note: See TracTickets for help on using tickets.