From 955a99ea28a0d06de67f0595d366450281aab0c0 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Sat, 28 Jan 2023 22:12:35 +0000 Subject: Treat existentials correctly in dubiousDataConInstArgTys Consider (#22849) data T a where MkT :: forall k (t::k->*) (ix::k). t ix -> T @k a Then dubiousDataConInstArgTys MkT [Type, Foo] should return [Foo (ix::Type)] NOT [Foo (ix::k)] A bit of an obscure case, but it's an outright bug, and the fix is easy. --- testsuite/tests/simplCore/should_compile/T22849.hs | 14 ++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 testsuite/tests/simplCore/should_compile/T22849.hs (limited to 'testsuite') diff --git a/testsuite/tests/simplCore/should_compile/T22849.hs b/testsuite/tests/simplCore/should_compile/T22849.hs new file mode 100644 index 0000000000..a4c5179251 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T22849.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE GADTs #-} + +module T22849 where + +data Foo a where + Foo :: Foo Int + +data Bar a = Bar a (Foo a) + +data Some t = forall ix. Some (t ix) + +instance Show (Some Bar) where + show (Some (Bar v t)) = case t of + Foo -> show v diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 927ac191f6..1a2ac5f7d0 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -453,7 +453,7 @@ test('T22375', normal, compile, ['-O -ddump-simpl -dsuppress-uniques -dno-typeab test('T21851_2', [grep_errmsg(r'wwombat') ], multimod_compile, ['T21851_2', '-O -dno-typeable-binds -dsuppress-uniques']) # Should not inline m, so there shouldn't be a single YES test('T22317', [grep_errmsg(r'ANSWER = YES') ], compile, ['-O -dinline-check m -ddebug-output']) - +test('T22849', normal, compile, ['-O']) test('T22634', normal, compile, ['-O -fcatch-nonexhaustive-cases']) test('T22494', [grep_errmsg(r'case') ], compile, ['-O -ddump-simpl -dsuppress-uniques']) test('T22491', normal, compile, ['-O2']) @@ -472,3 +472,4 @@ test('T22611', [when(wordsize(32), skip), grep_errmsg(r'\$salterF') ], compile, test('T22715_2', normal, multimod_compile, ['T22715_2', '-v0 -O -fspecialise-aggressively']) test('T22802', normal, compile, ['-O']) test('T15205', normal, compile, ['-O -ddump-simpl -dno-typeable-binds -dsuppress-uniques']) + -- cgit v1.2.1