Skip to content
Snippets Groups Projects
Commit 7e1758a9 authored by Joachim Breitner's avatar Joachim Breitner Committed by Herbert Valerio Riedel
Browse files

Test case for #10176

originally provided by Neil Mitchell. Despite what he observed, I can
observe the bug even with all in one module.

(cherry picked from commit 5119e097)
parent 507c9683
No related branches found
No related tags found
No related merge requests found
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 ()
...@@ -209,3 +209,4 @@ test('T6056', only_ways(['optasm']), multimod_compile, ['T6056', '-v0 -ddump-rul ...@@ -209,3 +209,4 @@ test('T6056', only_ways(['optasm']), multimod_compile, ['T6056', '-v0 -ddump-rul
test('T9400', only_ways(['optasm']), compile, ['-O0 -ddump-simpl -dsuppress-uniques']) test('T9400', only_ways(['optasm']), compile, ['-O0 -ddump-simpl -dsuppress-uniques'])
test('T9583', only_ways(['optasm']), compile, ['']) test('T9583', only_ways(['optasm']), compile, [''])
test('T9565', only_ways(['optasm']), compile, ['']) test('T9565', only_ways(['optasm']), compile, [''])
test('T10176', [only_ways(['optasm']), expect_broken(10176)], compile, [''])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment