diff options
author | Roland Senn <rsx@bluewin.ch> | 2021-11-11 11:31:34 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-25 05:01:21 -0500 |
commit | b24e8d912cf3fe37a132c91fa640939fcff79215 (patch) | |
tree | 9bfc95824671e0ced8a6021bda4eed7eeb1c99c0 | |
parent | b742475a2388b8d8a0905f6eb23a8e4fb652f77f (diff) | |
download | haskell-b24e8d912cf3fe37a132c91fa640939fcff79215.tar.gz |
GHCi Debugger - Improve RTTI
When processing the heap, use also `APClosures` to create additional type
constraints. This adds more equations and therefore improves the unification
process to infer the correct type of values at breakpoints.
(Fix the `incr` part of #19559)
-rw-r--r-- | compiler/GHC/Runtime/Heap/Inspect.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/break012.stdout | 8 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/break026.stdout | 12 |
3 files changed, 13 insertions, 10 deletions
diff --git a/compiler/GHC/Runtime/Heap/Inspect.hs b/compiler/GHC/Runtime/Heap/Inspect.hs index e707153137..c01cf10da3 100644 --- a/compiler/GHC/Runtime/Heap/Inspect.hs +++ b/compiler/GHC/Runtime/Heap/Inspect.hs @@ -1045,6 +1045,9 @@ cvReconstructType hsc_env max_depth old_ty hval = runTR_maybe hsc_env $ do world <- newVar liftedTypeKind addConstraint my_ty (mkTyConApp mutVarPrimTyCon [world,tv']) return [(tv', contents)] + APClosure {payload=pLoad} -> do -- #19559 (incr) + mapM_ (go my_ty) pLoad + return [] ConstrClosure{ptrArgs=pArgs} -> do Right dcname <- liftIO $ constrClosToName hsc_env clos traceTR (text "Constr1" <+> ppr dcname) diff --git a/testsuite/tests/ghci.debugger/scripts/break012.stdout b/testsuite/tests/ghci.debugger/scripts/break012.stdout index 5d478ae04e..dfc09e2186 100644 --- a/testsuite/tests/ghci.debugger/scripts/break012.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break012.stdout @@ -1,14 +1,14 @@ Stopped in Main.g, break012.hs:5:10-18 -_result :: (a1, a2 -> a2, (), a -> a -> a) = _ -a :: a1 = _ +_result :: (Integer, a2 -> a2, (), a -> a -> a) = _ +a :: Integer = _ b :: a3 -> a3 = _ c :: () = _ d :: a -> a -> a = _ -a :: a1 +a :: Integer b :: a3 -> a3 c :: () d :: a -> a -> a -a = (_t1::a1) +a = (_t1::Integer) b = (_t2::a3 -> a3) c = (_t3::()) d = (_t4::a -> a -> a) diff --git a/testsuite/tests/ghci.debugger/scripts/break026.stdout b/testsuite/tests/ghci.debugger/scripts/break026.stdout index 79acc3d8ac..0d8d87c461 100644 --- a/testsuite/tests/ghci.debugger/scripts/break026.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break026.stdout @@ -10,9 +10,9 @@ f :: Int -> Int -> Int = _ x :: Int = 1 xs :: [Int] = _ Stopped in Test.foldl.go, break026.hs:7:23-35 -_result :: t = _ -c :: t = _ -f :: t -> Int -> t = _ +_result :: Int = _ +c :: Int = _ +f :: Int -> Int -> Int = _ x :: Int = 2 xs :: [Int] = _ c = 1 @@ -28,9 +28,9 @@ f :: Int -> Int -> Int = _ x :: Int = 1 xs :: [Int] = _ Stopped in Test.foldl.go, break026.hs:7:23-35 -_result :: t = _ -c :: t = _ -f :: t -> Int -> t = _ +_result :: Int = _ +c :: Int = _ +f :: Int -> Int -> Int = _ x :: Int = 2 xs :: [Int] = _ Stopped in Test.foldl.go, break026.hs:7:27-31 |