diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-04-06 15:51:38 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-23 18:53:13 -0400 |
commit | d82d38239f232c3970a8641bb6d47d436e3cbc11 (patch) | |
tree | 55b162143144486cddda1b2a2a7ca0b7eb373a1c /testsuite/tests/ghc-api | |
parent | 82c6a9394b0457e77bc8b03e3594111b51508469 (diff) | |
download | haskell-d82d38239f232c3970a8641bb6d47d436e3cbc11.tar.gz |
Introduce Strict.Maybe, Strict.Pair (#19156)
This patch fixes a space leak related to the use of
Maybe in RealSrcSpan by introducing a strict variant
of Maybe.
In addition to that, it also introduces a strict pair
and uses the newly introduced strict data types in a few
other places (e.g. the lexer/parser state) to reduce
allocations.
Includes a regression test.
Diffstat (limited to 'testsuite/tests/ghc-api')
-rw-r--r-- | testsuite/tests/ghc-api/T19156.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/all.T | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/testsuite/tests/ghc-api/T19156.hs b/testsuite/tests/ghc-api/T19156.hs index 999c1af242..21aad3f196 100644 --- a/testsuite/tests/ghc-api/T19156.hs +++ b/testsuite/tests/ghc-api/T19156.hs @@ -4,14 +4,15 @@ import GHC.Exts.Heap import GHC.Types.SrcLoc +import qualified GHC.Data.Strict as Strict rsl :: RealSrcLoc rsl = mkRealSrcLoc "Foo" 1 1 main = do - let !s1 = RealSrcLoc rsl (Just (BufPos 999222)) - !s2 = RealSrcLoc rsl (Just (BufPos 999333)) - !s3 = RealSrcLoc rsl (Just (BufPos 999444)) + let !s1 = RealSrcLoc rsl (Strict.Just (BufPos 999222)) + !s2 = RealSrcLoc rsl (Strict.Just (BufPos 999333)) + !s3 = RealSrcLoc rsl (Strict.Just (BufPos 999444)) !res = combineSrcSpans (combineSrcSpans (srcLocSpan s1) (srcLocSpan s2)) (srcLocSpan s3) cs <- unbox res diff --git a/testsuite/tests/ghc-api/all.T b/testsuite/tests/ghc-api/all.T index 00e158516e..9ee14ba3ae 100644 --- a/testsuite/tests/ghc-api/all.T +++ b/testsuite/tests/ghc-api/all.T @@ -24,6 +24,6 @@ test('T18522-dbg-ppr', extra_run_opts('"' + config.libdir + '"'), compile_and_run, ['-package ghc']) -test('T19156', [extra_run_opts('"' + config.libdir + '"'), expect_broken(19156)], +test('T19156', extra_run_opts('"' + config.libdir + '"'), compile_and_run, ['-package ghc']) |