summaryrefslogtreecommitdiff
path: root/testsuite/tests/stranal/sigs/T18086.hs
blob: 9a6f67c6d1b63eab4d270b51df697beeb9ea2cfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# OPTIONS_GHC -O2 -fforce-recomp #-}
module T18086 where

import GHC.Stack
import GHC.Utils.Panic.Plain
import Control.Exception
import System.IO.Unsafe

-- Should have strictness signature <L,U>x, emphasis on the exceptional
-- divergence result.
m :: IO ()
m = do
  putStrLn "foo"
  error "bar"

-- Ditto, just in a more complex scenario (the original reproducer of #18086)
panic :: String -> a
panic x = unsafeDupablePerformIO $ do
  stack <- ccsToStrings =<< getCurrentCCS x
  if null stack
  then throw (PlainPanic x)
  else throw (PlainPanic (x ++ '\n' : renderStack stack))