summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2021-11-11 15:20:43 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2021-11-11 15:20:43 +0100
commitb2304b3fc766cb1cdabc58f4e904c4508dae648b (patch)
treee2c70fdff0ae63fdd67bcd169d06cd60b648049e
parent3035c37601c81d02db7ff822ab5a48a3b750ec1f (diff)
downloadhaskell-wip/T20663.tar.gz
Add regression test for #20663wip/T20663
-rw-r--r--testsuite/tests/stranal/should_compile/T20663.hs20
-rw-r--r--testsuite/tests/stranal/should_compile/T20663.stderr134
-rw-r--r--testsuite/tests/stranal/should_compile/all.T2
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..68f2ee50d6
--- /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 = \ (dt :: Int) (dt :: Int) -> case dt of { GHC.Types.I# dt -> case dt of { GHC.Types.I# dt -> T20663.Foo dt dt } }
+
+-- RHS size: {terms: 11, types: 6, coercions: 0, joins: 0/0}
+T20663.$WGram :: Int %1 -> Int %1 -> Gram
+T20663.$WGram = \ (dt :: Int) (dt :: Int) -> case dt of { GHC.Types.I# dt -> case dt of { GHC.Types.I# dt -> T20663.Gram dt dt } }
+
+-- RHS size: {terms: 7, types: 6, coercions: 0, joins: 0/0}
+T20663.$wyeah :: GHC.Prim.Int# -> GHC.Prim.Int# -> (# Int, Int #)
+T20663.$wyeah = \ (ww :: GHC.Prim.Int#) (ww1 :: GHC.Prim.Int#) -> (# GHC.Types.I# ww, GHC.Types.I# ww1 #)
+
+-- RHS size: {terms: 12, types: 13, coercions: 0, joins: 0/0}
+yeah :: Gram -> (Int, Int)
+yeah = \ (w :: Gram) -> case w of { Gram ww1 ww2 -> case T20663.$wyeah ww1 ww2 of { (# ww4, ww5 #) -> (ww4, ww5) } }
+
+-- RHS size: {terms: 7, types: 6, coercions: 0, joins: 0/0}
+T20663.$wbam :: GHC.Prim.Int# -> GHC.Prim.Int# -> (# Int, Int #)
+T20663.$wbam = \ (ww :: GHC.Prim.Int#) (ww1 :: GHC.Prim.Int#) -> (# GHC.Types.I# ww, GHC.Types.I# ww1 #)
+
+-- RHS size: {terms: 12, types: 13, coercions: 0, joins: 0/0}
+bam :: Foo -> (Int, Int)
+bam = \ (w :: Foo) -> case w of { Foo ww1 ww2 -> case T20663.$wbam ww1 ww2 of { (# ww4, ww5 #) -> (ww4, ww5) } }
+
+-- 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## 4126058292614824653## 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## 5635348526001679009## 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## 12966498080784616609## 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## 9262896337475646272## 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 61e9c58dee..84d0f36641 100644
--- a/testsuite/tests/stranal/should_compile/all.T
+++ b/testsuite/tests/stranal/should_compile/all.T
@@ -64,6 +64,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('T19849', normal, compile, [''])