diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-07-31 14:07:43 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-08-04 18:18:08 -0400 |
commit | 3b31a94df4cf7e55d93dfcad9b96d0f49f4d3f8d (patch) | |
tree | e53d82f360769969a68a710b9605abcf8ff394cc /testsuite | |
parent | 7d8d0012acd8701c0bb562376fd8321009342dcd (diff) | |
download | haskell-3b31a94df4cf7e55d93dfcad9b96d0f49f4d3f8d.tar.gz |
testsuite: Add testsuite for #16978
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T16978.hs | 29 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T16978.hs b/testsuite/tests/simplCore/should_compile/T16978.hs new file mode 100644 index 0000000000..cf78013dfd --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T16978.hs @@ -0,0 +1,29 @@ +-- | Caused Core Lint failure due to floating of unlifted join point to the +-- top-level. +module Bug where + +import Control.Monad.Trans.State.Strict (State, modify') +import Data.Text (Text) +import qualified Data.Text.Lazy.Builder as B + +data Value = String !Text | Null + +type Render a = State B.Builder a + +tellBuilder :: B.Builder -> Render () +tellBuilder b' = modify' f where + f b = b <> b' + +renderNode :: Value -> Render () +renderNode v = + renderValue v >>= outputRaw + +outputRaw :: Text -> Render () +outputRaw = tellBuilder . B.fromText +{-# INLINE outputRaw #-} + +renderValue :: Value -> Render Text +renderValue v = case v of + String str -> return str + _ -> let x = x in x +{-# INLINE renderValue #-} diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 7cfbc21cd2..94406ba5ca 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -305,5 +305,6 @@ test('T16288', normal, multimod_compile, ['T16288B', '-O -dcore-lint -v0']) test('T16348', normal, compile, ['-O']) test('T16918', normal, compile, ['-O']) test('T16918a', normal, compile, ['-O']) +test('T16978', normal, compile, ['-O']) test('T16979a', normal, compile, ['-O']) test('T16979b', normal, compile, ['-O']) |