Commit 5119e097 authored by Joachim Breitner's avatar Joachim Breitner

Test case for #10176

originally provided by Neil Mitchell. Despite what he observed, I can
observe the bug even with all in one module.
parent 29f7c103
module T10176(buggy) where
{-# NOINLINE error2Args #-}
error2Args :: () -> () -> a
error2Args _ _ = error "here"
newtype ReaderT r a = ReaderT { runReaderT :: r -> IO a }
instance Functor (ReaderT r) where
fmap = undefined
instance Applicative (ReaderT r) where
pure = liftReaderT . pure
f <*> v = undefined
instance Monad (ReaderT r) where
return = liftReaderT . return
m >>= k = undefined
m >> k = ReaderT $ \r -> do runReaderT m r; runReaderT k r
liftReaderT :: IO a -> ReaderT r a
liftReaderT m = ReaderT (const m)
{-# NOINLINE buggy #-}
buggy fun unit bool =
runReaderT (do
if bool then liftReaderT $ print () else pure ()
case fun unit of
True -> do
error2Args unit unit
pure ()
_ -> pure ()
) () :: IO ()
......@@ -211,3 +211,4 @@ test('T9400', only_ways(['optasm']), compile, ['-O0 -ddump-simpl -dsuppress-uniq
test('T9583', only_ways(['optasm']), compile, [''])
test('T9565', only_ways(['optasm']), compile, [''])
test('T5821', only_ways(['optasm']), compile, [''])
test('T10176', [only_ways(['optasm']), expect_broken(10176)], compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment