diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-03-21 17:48:45 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-24 17:13:59 -0400 |
commit | fefd4e312f0249117f2d5a5a6962edb1e0b6ed19 (patch) | |
tree | 377c45775507f1ef031ed27fa00904982ce35d84 /testsuite | |
parent | 99623358754d812b8b4bdfcdc57190d38617b9cc (diff) | |
download | haskell-fefd4e312f0249117f2d5a5a6962edb1e0b6ed19.tar.gz |
testsuite: Remove library dependenices from T21119
These dependencies would affect the demand signature depending on
various rules and so on.
Fixes #21271
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/stranal/sigs/T21119.hs | 31 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T21119.stderr | 26 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/all.T | 1 |
3 files changed, 45 insertions, 13 deletions
diff --git a/testsuite/tests/stranal/sigs/T21119.hs b/testsuite/tests/stranal/sigs/T21119.hs index 7be2cf1788..8bebcf5b16 100644 --- a/testsuite/tests/stranal/sigs/T21119.hs +++ b/testsuite/tests/stranal/sigs/T21119.hs @@ -3,12 +3,31 @@ -- {-# LANGUAGE PatternSynonyms #-} -- {-# LANGUAGE BangPatterns #-} -- {-# LANGUAGE MagicHash, UnboxedTuples #-} -module T21119 where +{-# LANGUAGE MagicHash #-} +module T21119 ( get, getIO, indexError, throwIndexError ) where -import Control.Exception +import Control.Exception (Exception(..)) +import GHC.IO hiding (throwIO) +import GHC.Exts -indexError :: Show a => (a, a) -> a -> String -> b -indexError rng i s = error (show rng ++ show i ++ show s) +throwIO :: Exception e => e -> IO a +throwIO e = IO (raiseIO# (toException e)) + +myconcat :: [[a]] -> [a] +myconcat = concat +{-# NOINLINE myconcat #-} + +class MyShow a where + myshow :: a -> String + +instance MyShow Int where + myshow !_ = "0" + +instance MyShow (a, b) where + myshow !_ = "()" + +indexError :: MyShow a => (a, a) -> a -> String -> b +indexError rng i s = errorWithoutStackTrace (myconcat [myshow rng, myshow i, s]) get :: (Int, Int) -> Int -> [a] -> a get p@(l,u) i xs @@ -17,8 +36,8 @@ get p@(l,u) i xs -- Now the same with precise exceptions: -throwIndexError :: Show a => (a, a) -> a -> String -> IO b -throwIndexError rng i s = throwIO (userError (show rng ++ show i ++ show s)) +throwIndexError :: MyShow a => (a, a) -> a -> String -> IO b +throwIndexError rng i s = throwIO (userError (myconcat [myshow rng, myshow i, s])) -- It's important that we don't unbox 'u' here. -- We may or may not unbox 'p' and 'l'. diff --git a/testsuite/tests/stranal/sigs/T21119.stderr b/testsuite/tests/stranal/sigs/T21119.stderr index dfefcdea03..0a398888d0 100644 --- a/testsuite/tests/stranal/sigs/T21119.stderr +++ b/testsuite/tests/stranal/sigs/T21119.stderr @@ -1,14 +1,22 @@ ==================== Strictness signatures ==================== +T21119.$fMyShow(,): <1!A> +T21119.$fMyShowInt: <1!A> +T21119.$tc'C:MyShow: +T21119.$tcMyShow: T21119.$trModule: -T21119.get: <1!P(S!P(L),S!P(L))><1!P(L)><1L> -T21119.getIO: <1P(SL,L)><1L><ML><L> -T21119.indexError: <S!P(SCS(C1(L)),1C1(L),B)><1!S><S!S><1!S>b -T21119.throwIndexError: <LP(LCL(C1(L)),MCM(L),A)><ML><L><ML><L>x +T21119.get: <1!P(1!P(L),1!P(L))><1!P(L)><1L> +T21119.getIO: <1P(1L,ML)><1L><ML><L> +T21119.indexError: <1C1(L)><1!B><S!S><S!S>b +T21119.throwIndexError: <MCM(L)><MA><L><L><L>x ==================== Cpr signatures ==================== +T21119.$fMyShow(,): +T21119.$fMyShowInt: +T21119.$tc'C:MyShow: +T21119.$tcMyShow: T21119.$trModule: T21119.get: T21119.getIO: 1 @@ -18,10 +26,14 @@ T21119.throwIndexError: b ==================== Strictness signatures ==================== +T21119.$fMyShow(,): <1!A> +T21119.$fMyShowInt: <1!A> +T21119.$tc'C:MyShow: +T21119.$tcMyShow: T21119.$trModule: T21119.get: <1!P(1!P(L),1!P(L))><1!P(L)><1L> -T21119.getIO: <1P(SL,L)><1L><ML><L> -T21119.indexError: <1P(SCS(C1(L)),1C1(L),B)><1!S><S!S><1!S>b -T21119.throwIndexError: <LP(LCL(C1(L)),MCM(L),A)><ML><L><ML><L>x +T21119.getIO: <1P(1L,ML)><1L><ML><L> +T21119.indexError: <1C1(L)><1!B><S!S><S!S>b +T21119.throwIndexError: <MCM(L)><MA><L><L><L>x diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T index 59a4891f6d..876d2242d8 100644 --- a/testsuite/tests/stranal/sigs/all.T +++ b/testsuite/tests/stranal/sigs/all.T @@ -31,4 +31,5 @@ test('T18907', normal, compile, ['']) test('T13331', normal, compile, ['']) test('T20746', normal, compile, ['']) test('T20746b', normal, compile, ['']) + test('T21119', normal, compile, ['']) |