diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2022-08-26 12:16:01 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-08-27 00:30:14 -0400 |
commit | 161a6f1fd62e797e978e7808a5f567fefa123f16 (patch) | |
tree | 9c0980da8b2d8ca82a01736cd4a9b071b610b30e /testsuite | |
parent | a3b23a3318a556beba62a3637600692639575c44 (diff) | |
download | haskell-161a6f1fd62e797e978e7808a5f567fefa123f16.tar.gz |
Fix a nasty loop in Tidy
As the remarkably-simple #22112 showed, we were making a black hole
in the unfolding of a self-recursive binding. Boo!
It's a bit tricky. Documented in GHC.Iface.Tidy,
Note [tidyTopUnfolding: avoiding black holes]
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T22112.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T22112.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T22112.hs b/testsuite/tests/simplCore/should_compile/T22112.hs new file mode 100644 index 0000000000..19291c39dc --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T22112.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE NoImplicitPrelude #-} +module Rec where + +-- This one created a black hole in Tidy, +-- when creating the tidied unfolding for foo +foo :: () -> () +foo = foo diff --git a/testsuite/tests/simplCore/should_compile/T22112.stderr b/testsuite/tests/simplCore/should_compile/T22112.stderr new file mode 100644 index 0000000000..1a97dd9b41 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T22112.stderr @@ -0,0 +1,14 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core + = {terms: 2, types: 2, coercions: 0, joins: 0/0} + +Rec { +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +foo [Occ=LoopBreaker] :: () -> () +[GblId, Str=b, Cpr=b] +foo = foo +end Rec } + + + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index f37e56373c..b66692e8eb 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -415,6 +415,7 @@ test('T17966', [ grep_errmsg(r'SPEC') ], compile, ['-O -ddump-spec']) # We expect to see a SPEC rule for $cm test('T19644', [ grep_errmsg(r'SPEC') ], compile, ['-O -ddump-spec']) test('T21391', normal, compile, ['-O -dcore-lint']) +test('T22112', normal, compile, ['-O -dsuppress-uniques -dno-typeable-binds -ddump-simpl']) test('T21391a', normal, compile, ['-O -dcore-lint']) # We don't want to see a thunk allocation for the insertBy expression after CorePrep. test('T21392', [ grep_errmsg(r'sat.* :: \[\(.*Unique, .*Int\)\]'), expect_broken(21392) ], compile, ['-O -ddump-prep -dno-typeable-binds -dsuppress-uniques']) |