diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2021-11-11 15:20:43 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-12 21:27:26 -0500 |
commit | b040d0d4f1aab4fda1b862fa1f81df1aee8372d4 (patch) | |
tree | 585da0ad3c3f977a779f0aa675ea91c4eabfa48d | |
parent | 0b1da2f1e911e941310a20ed7650670d624f6ebe (diff) | |
download | haskell-b040d0d4f1aab4fda1b862fa1f81df1aee8372d4.tar.gz |
Add regression test for #20663
-rw-r--r-- | testsuite/tests/stranal/should_compile/T20663.hs | 20 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/T20663.stderr | 134 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/all.T | 2 |
3 files changed, 156 insertions, 0 deletions
diff --git a/testsuite/tests/stranal/should_compile/T20663.hs b/testsuite/tests/stranal/should_compile/T20663.hs new file mode 100644 index 0000000000..e35337d5ca --- /dev/null +++ b/testsuite/tests/stranal/should_compile/T20663.hs @@ -0,0 +1,20 @@ +{-# language UnliftedDatatypes #-} +{-# language BangPatterns #-} + +module T20663 where + +import GHC.Exts (UnliftedType) + +type Gram :: UnliftedType +data Gram = Gram !Int !Int + +{-# NOINLINE yeah #-} +yeah :: Gram -> (Int, Int) +yeah g = (case g of Gram a _ -> a, case g of Gram _ b -> b) + +data Foo = Foo !Int !Int + +{-# NOINLINE bam #-} +bam :: Foo -> (Int, Int) +bam !f = (case f of Foo a _ -> a, case f of Foo _ b -> b) + diff --git a/testsuite/tests/stranal/should_compile/T20663.stderr b/testsuite/tests/stranal/should_compile/T20663.stderr new file mode 100644 index 0000000000..94ab8a54dd --- /dev/null +++ b/testsuite/tests/stranal/should_compile/T20663.stderr @@ -0,0 +1,134 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core = {terms: 166, types: 107, coercions: 0, joins: 0/0} + +-- RHS size: {terms: 11, types: 6, coercions: 0, joins: 0/0} +T20663.$WFoo :: Int %1 -> Int %1 -> Foo +T20663.$WFoo = \ (conrep :: Int) (conrep :: Int) -> case conrep of { GHC.Types.I# unbx -> case conrep of { GHC.Types.I# unbx -> T20663.Foo unbx unbx } } + +-- RHS size: {terms: 11, types: 6, coercions: 0, joins: 0/0} +T20663.$WGram :: Int %1 -> Int %1 -> Gram +T20663.$WGram = \ (conrep :: Int) (conrep :: Int) -> case conrep of { GHC.Types.I# unbx -> case conrep of { GHC.Types.I# unbx -> T20663.Gram unbx unbx } } + +-- RHS size: {terms: 5, types: 6, coercions: 0, joins: 0/0} +T20663.$wyeah :: GHC.Prim.Int# -> GHC.Prim.Int# -> (# GHC.Prim.Int#, GHC.Prim.Int# #) +T20663.$wyeah = \ (ww :: GHC.Prim.Int#) (ww1 :: GHC.Prim.Int#) -> (# ww, ww1 #) + +-- RHS size: {terms: 14, types: 13, coercions: 0, joins: 0/0} +yeah :: Gram -> (Int, Int) +yeah = \ (g :: Gram) -> case g of { Gram ww ww1 -> case T20663.$wyeah ww ww1 of { (# ww2, ww3 #) -> (GHC.Types.I# ww2, GHC.Types.I# ww3) } } + +-- RHS size: {terms: 5, types: 6, coercions: 0, joins: 0/0} +T20663.$wbam :: GHC.Prim.Int# -> GHC.Prim.Int# -> (# GHC.Prim.Int#, GHC.Prim.Int# #) +T20663.$wbam = \ (ww :: GHC.Prim.Int#) (ww1 :: GHC.Prim.Int#) -> (# ww, ww1 #) + +-- RHS size: {terms: 14, types: 13, coercions: 0, joins: 0/0} +bam :: Foo -> (Int, Int) +bam = \ (f :: Foo) -> case f of { Foo ww ww1 -> case T20663.$wbam ww ww1 of { (# ww2, ww3 #) -> (GHC.Types.I# ww2, GHC.Types.I# ww3) } } + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T20663.$trModule4 :: GHC.Prim.Addr# +T20663.$trModule4 = "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T20663.$trModule3 :: GHC.Types.TrName +T20663.$trModule3 = GHC.Types.TrNameS T20663.$trModule4 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T20663.$trModule2 :: GHC.Prim.Addr# +T20663.$trModule2 = "T20663"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T20663.$trModule1 :: GHC.Types.TrName +T20663.$trModule1 = GHC.Types.TrNameS T20663.$trModule2 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T20663.$trModule :: GHC.Types.Module +T20663.$trModule = GHC.Types.Module T20663.$trModule3 T20663.$trModule1 + +-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0} +$krep :: GHC.Types.KindRep +$krep = GHC.Types.KindRepTyConApp GHC.Types.$tcInt (GHC.Types.[] @GHC.Types.KindRep) + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +$krep1 :: GHC.Types.RuntimeRep +$krep1 = GHC.Types.BoxedRep GHC.Types.Unlifted + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T20663.$tcGram1 :: GHC.Types.KindRep +T20663.$tcGram1 = GHC.Types.KindRepTYPE $krep1 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T20663.$tcGram3 :: GHC.Prim.Addr# +T20663.$tcGram3 = "Gram"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T20663.$tcGram2 :: GHC.Types.TrName +T20663.$tcGram2 = GHC.Types.TrNameS T20663.$tcGram3 + +-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} +T20663.$tcGram :: GHC.Types.TyCon +T20663.$tcGram = GHC.Types.TyCon 14476255489265172493##64 4126058292614824653##64 T20663.$trModule T20663.$tcGram2 0# T20663.$tcGram1 + +-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0} +$krep2 :: GHC.Types.KindRep +$krep2 = GHC.Types.KindRepTyConApp T20663.$tcGram (GHC.Types.[] @GHC.Types.KindRep) + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$krep3 :: GHC.Types.KindRep +$krep3 = GHC.Types.KindRepFun $krep $krep2 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Gram1 :: GHC.Types.KindRep +T20663.$tc'Gram1 = GHC.Types.KindRepFun $krep $krep3 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Gram3 :: GHC.Prim.Addr# +T20663.$tc'Gram3 = "'Gram"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Gram2 :: GHC.Types.TrName +T20663.$tc'Gram2 = GHC.Types.TrNameS T20663.$tc'Gram3 + +-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Gram :: GHC.Types.TyCon +T20663.$tc'Gram = GHC.Types.TyCon 6930635511997833813##64 5635348526001679009##64 T20663.$trModule T20663.$tc'Gram2 0# T20663.$tc'Gram1 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T20663.$tcFoo2 :: GHC.Prim.Addr# +T20663.$tcFoo2 = "Foo"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T20663.$tcFoo1 :: GHC.Types.TrName +T20663.$tcFoo1 = GHC.Types.TrNameS T20663.$tcFoo2 + +-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} +T20663.$tcFoo :: GHC.Types.TyCon +T20663.$tcFoo = GHC.Types.TyCon 4170886864186800403##64 12966498080784616609##64 T20663.$trModule T20663.$tcFoo1 0# GHC.Types.krep$* + +-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0} +$krep4 :: GHC.Types.KindRep +$krep4 = GHC.Types.KindRepTyConApp T20663.$tcFoo (GHC.Types.[] @GHC.Types.KindRep) + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$krep5 :: GHC.Types.KindRep +$krep5 = GHC.Types.KindRepFun $krep $krep4 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Foo1 :: GHC.Types.KindRep +T20663.$tc'Foo1 = GHC.Types.KindRepFun $krep $krep5 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Foo3 :: GHC.Prim.Addr# +T20663.$tc'Foo3 = "'Foo"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Foo2 :: GHC.Types.TrName +T20663.$tc'Foo2 = GHC.Types.TrNameS T20663.$tc'Foo3 + +-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} +T20663.$tc'Foo :: GHC.Types.TyCon +T20663.$tc'Foo = GHC.Types.TyCon 9844518566125716364##64 9262896337475646272##64 T20663.$trModule T20663.$tc'Foo2 0# T20663.$tc'Foo1 + + + diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T index d953da1da9..7a8d90c2d8 100644 --- a/testsuite/tests/stranal/should_compile/all.T +++ b/testsuite/tests/stranal/should_compile/all.T @@ -66,6 +66,8 @@ test('T18894', [ grep_errmsg(r'Dmd=\S+C\S+') ], compile, ['-ddump-stranal -dsup test('T18894b', [ grep_errmsg(r'Arity=2') ], compile, ['-ddump-stranal -dsuppress-uniques -fno-call-arity -dppr-cols=200']) # We care about the workers of f,g,h,i: test('T18982', [ grep_errmsg(r'\$w. .*Int#$') ], compile, ['-dppr-cols=1000 -ddump-simpl -dsuppress-idinfo -dsuppress-uniques']) +# We care about the type of $wyeah. The unlifted Gram constructor should unbox +test('T20663', [ grep_errmsg(r'\$wyeah ::') ], compile, ['-dppr-cols=1000 -ddump-simpl -dsuppress-idinfo -dsuppress-uniques']) test('T19180', normal, compile, ['']) test('T19766', [ grep_errmsg(r'absentError') ], compile, ['-ddump-worker-wrapper']) |