Ticket #6098 (new bug)
debugger does not know the correct type for a newtype field
| Reported by: | phercek | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 7.8.1 |
| Component: | GHCi | Version: | 7.5 |
| Keywords: | debugger bindings | Cc: | |
| Operating System: | Linux | Architecture: | x86_64 (amd64) |
| Type of failure: | Incorrect result at runtime | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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
headItem
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: http://www.haskell.org/ghc/ :? 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
6
vv
7 test Wrapper{ mItems = allItems } = id $
8 let headItem = head allItems in
9 headItem
^^
10
[bindings-bug.hs:(7,37)-(9,10)] *Main> head allItems
<interactive>:5:6:
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
1
*Main> :quit
Leaving GHCi.
18:06 tm=42 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1037>
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

