diff --git a/testsuite/tests/simplCore/should_compile/T10176.hs b/testsuite/tests/simplCore/should_compile/T10176.hs new file mode 100644 index 0000000000000000000000000000000000000000..e91ccda4e965a264fa18d7ab4892bf1f14f32e49 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T10176.hs @@ -0,0 +1,34 @@ + +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 () diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index bbdadbf1fa9c7ab6781e0a18e4d9c3317eaa7a47..998894abbfd7e79159cc45aa70aba8299437d926 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -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('T9583', only_ways(['optasm']), compile, ['']) test('T9565', only_ways(['optasm']), compile, ['']) +test('T10176', [only_ways(['optasm']), expect_broken(10176)], compile, [''])