diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-04-02 14:55:43 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-04-02 17:04:36 +0100 |
commit | 9187d5fb1d3d38a4e607b0d61784c21447c8195b (patch) | |
tree | b1a87443053aac9b55909fcd9e304dc077396f15 /testsuite | |
parent | 07abff7192dcc9ce667d3c5cdb3f34ca8c87f2fb (diff) | |
download | haskell-9187d5fb1d3d38a4e607b0d61784c21447c8195b.tar.gz |
Allow unpacking of single-data-con GADTs
Trac #14978 pointed out that single-constructor GADTs should be
unpackable without trouble.
Acutally I realise that even existentials should be unpackable
too, but that's a bit more work, so it's not part of this patch.
See Note [Unpacking GADTs and existentials] in MkId.
Diffstat (limited to 'testsuite')
4 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 33322f38a1..1f1bf25b69 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -2,6 +2,11 @@ TOP=../../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk +T14978: + $(RM) -f T14978.o T14978.hi + -'$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T14978.hs -dsuppress-coercions | grep 'foo' + # Expecting the defn of 'foo' to apply Goof to an unboxed coercion + T13468: $(RM) -f T13468.o T13468.hi -'$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T13468.hs | grep 'Error' diff --git a/testsuite/tests/simplCore/should_compile/T14978.hs b/testsuite/tests/simplCore/should_compile/T14978.hs new file mode 100644 index 0000000000..3fedb960d8 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14978.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE GADTs #-} +module T14978 where + +data Equal a b where + Refl :: Equal a a + +data Goof a where + Goof :: {-# UNPACK #-} !(Equal a Int) -> Goof a + + +foo :: Goof Int +foo = Goof Refl diff --git a/testsuite/tests/simplCore/should_compile/T14978.stdout b/testsuite/tests/simplCore/should_compile/T14978.stdout new file mode 100644 index 0000000000..1b12ead299 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T14978.stdout @@ -0,0 +1,2 @@ +foo :: Goof Int +foo = T14978.Goof @ Int @~ <Co:1> diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 13511ee4c0..a521a1084e 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -297,3 +297,7 @@ test('T14152a', [extra_files(['T14152.hs']), pre_cmd('cp T14152.hs T14152a.hs'), test('T13990', normal, compile, ['-dcore-lint -O']) test('T14650', normal, compile, ['-O2']) test('T14959', normal, compile, ['-O']) +test('T14978', + normal, + run_command, + ['$MAKE -s --no-print-directory T14978']) |