summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2022-04-07 17:21:08 +0200
committerSebastian Graf <sebastian.graf@kit.edu>2022-04-12 17:54:57 +0200
commit4d2ee313f23a4454d12c9f94ff132f078dd64d31 (patch)
treee7bd7b66f35660864f19feb998ab1d9ca96665fa /testsuite/tests
parent0090ad7b8b436961fe1e225aae214d0ea1381c07 (diff)
downloadhaskell-4d2ee313f23a4454d12c9f94ff132f078dd64d31.tar.gz
Specialising through specialised method calls (#19644)
In #19644, we discovered that the ClassOp/DFun rules from Note [ClassOp/DFun selection] inhibit transitive specialisation in a scenario like ``` class C a where m :: Show b => a -> b -> ...; n :: ... instance C Int where m = ... -- $cm :: Show b => Int -> b -> ... f :: forall a b. (C a, Show b) => ... f $dC $dShow = ... m @a $dC @b $dShow ... main = ... f @Int @Bool ... ``` After we specialise `f` for `Int`, we'll see `m @a $dC @b $dShow` in the body of `$sf`. But before this patch, Specialise doesn't apply the ClassOp/DFun rule to rewrite to a call of the instance method for `C Int`, e.g., `$cm @Bool $dShow`. As a result, Specialise couldn't further specialise `$cm` for `Bool`. There's a better example in `Note [Specialisation modulo dictionary selectors]`. This patch enables proper Specialisation, as follows: 1. In the App case of `specExpr`, try to apply the CalssOp/DictSel rule on the head of the application 2. Attach an unfolding to freshly-bound dictionary ids such as `$dC` and `$dShow` in `bindAuxiliaryDict` NB: Without (2), (1) would be pointless, because `lookupRule` wouldn't be able to look into the RHS of `$dC` to see the DFun. (2) triggered #21332, because the Specialiser floats around dictionaries without accounting for them in the `SpecEnv`'s `InScopeSet`, triggering a panic when rewriting dictionary unfoldings. Fixes #19644 and #21332.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/perf/compiler/T4007.stdout1
-rw-r--r--testsuite/tests/perf/compiler/all.T1
-rw-r--r--testsuite/tests/simplCore/should_compile/Makefile5
-rw-r--r--testsuite/tests/simplCore/should_compile/T17966.stderr310
-rw-r--r--testsuite/tests/simplCore/should_compile/T19644.hs20
-rw-r--r--testsuite/tests/simplCore/should_compile/T19644.stderr246
-rw-r--r--testsuite/tests/simplCore/should_compile/T6056.stderr1
-rw-r--r--testsuite/tests/simplCore/should_compile/T7785.stderr410
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T12
9 files changed, 990 insertions, 16 deletions
diff --git a/testsuite/tests/perf/compiler/T4007.stdout b/testsuite/tests/perf/compiler/T4007.stdout
index c83de9cfd9..fc69f2c1c3 100644
--- a/testsuite/tests/perf/compiler/T4007.stdout
+++ b/testsuite/tests/perf/compiler/T4007.stdout
@@ -3,7 +3,6 @@ Rule fired: Class op return (BUILTIN)
Rule fired: unpack (GHC.Base)
Rule fired: fold/build (GHC.Base)
Rule fired: Class op >> (BUILTIN)
-Rule fired: Class op >> (BUILTIN)
Rule fired: SPEC/T4007 sequence__c @IO _ _ (T4007)
Rule fired: <# (BUILTIN)
Rule fired: tagToEnum# (BUILTIN)
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 5cbe3b6e51..17bb717ee9 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -54,6 +54,7 @@ test('T3064',
compile,
[''])
+# The foldr/build rule is the important one
test('T4007', normal, makefile_test, ['T4007'])
test('T5030',
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index b5041800ed..02358e1746 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -13,11 +13,6 @@ T18815:
$(RM) -f T18815.o T18815.hi
- '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T18815.hs 2> /dev/null | grep 'join '
-T17966:
- $(RM) -f T17966.o T17966.hi
- - '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-spec T17966.hs 2> /dev/null | grep 'SPEC'
- # Expecting a SPEC rule for $cm
-
T17409:
$(RM) -f T17409.o T17409.hi
- '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -dverbose-core2core -dsuppress-uniques T17409.hs 2> /dev/null | grep '\<id\>'
diff --git a/testsuite/tests/simplCore/should_compile/T17966.stderr b/testsuite/tests/simplCore/should_compile/T17966.stderr
new file mode 100644
index 0000000000..24e09d538f
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17966.stderr
@@ -0,0 +1,310 @@
+
+==================== Specialise ====================
+Result size of Specialise
+ = {terms: 166, types: 158, coercions: 24, joins: 0/0}
+
+-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
+$dShow_sRN :: Show (Maybe Integer)
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=False, Value=False, ConLike=True,
+ WorkFree=False, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+$dShow_sRN = GHC.Show.$fShowMaybe @Integer GHC.Show.$fShowInteger
+
+Rec {
+-- RHS size: {terms: 2, types: 1, coercions: 4, joins: 0/0}
+$dC_sRM :: C Bool ()
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 60}]
+$dC_sRM
+ = ($cm_aHo @() GHC.Show.$fShow())
+ `cast` (Sym (T17966.N:C[0] <Bool>_N <()>_N)
+ :: (forall c. Show c => Bool -> () -> c -> String) ~R# C Bool ())
+
+-- RHS size: {terms: 30, types: 24, coercions: 0, joins: 0/0}
+$s$cm_sRQ [InlPrag=[0]]
+ :: forall {c}. Show c => Bool -> () -> c -> [Char]
+[LclId, Arity=4]
+$s$cm_sRQ
+ = \ (@c_aHr)
+ ($dShow_aHs :: Show c_aHr)
+ (a_aBf :: Bool)
+ (b_aBg :: ())
+ (c_aBh :: c_aHr) ->
+ GHC.Base.augment
+ @Char
+ (\ (@b_aQg)
+ (c_aQh [OS=OneShot] :: Char -> b_aQg -> b_aQg)
+ (n_aQi [OS=OneShot] :: b_aQg) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQg
+ c_aQh
+ n_aQi
+ (case a_aBf of {
+ False -> GHC.Show.$fShowBool5;
+ True -> GHC.Show.$fShowBool4
+ }))
+ (GHC.Base.augment
+ @Char
+ (\ (@b_aQg)
+ (c_aQh [OS=OneShot] :: Char -> b_aQg -> b_aQg)
+ (n_aQi [OS=OneShot] :: b_aQg) ->
+ GHC.Base.foldr
+ @Char @b_aQg c_aQh n_aQi (GHC.Show.$fShow()_$cshow b_aBg))
+ (show @c_aHr $dShow_aHs c_aBh))
+
+-- RHS size: {terms: 33, types: 28, coercions: 0, joins: 0/0}
+$cm_aHo [InlPrag=INLINABLE[0]]
+ :: forall b c. (Show b, Show c) => Bool -> b -> c -> String
+[LclId,
+ Arity=5,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=IF_ARGS [30 30 30 0 0] 140 0
+ Tmpl= \ (@b_aHl)
+ ($dShow_aHm [Occ=Once1] :: Show b_aHl)
+ (@c_aHr)
+ ($dShow_aHs [Occ=Once1] :: Show c_aHr)
+ (a_aBf [Occ=Once1!] :: Bool)
+ (b_aBg [Occ=Once1] :: b_aHl)
+ (c_aBh [Occ=Once1] :: c_aHr) ->
+ ++
+ @Char
+ (case a_aBf of {
+ False -> GHC.Show.$fShowBool5;
+ True -> GHC.Show.$fShowBool4
+ })
+ (++
+ @Char
+ (show @b_aHl $dShow_aHm b_aBg)
+ (show @c_aHr $dShow_aHs c_aBh))},
+ RULES: "SPEC $cm @()" [0]
+ forall ($dShow_sRP :: Show ()). $cm_aHo @() $dShow_sRP = $s$cm_sRQ]
+$cm_aHo
+ = \ (@b_aHl)
+ ($dShow_aHm :: Show b_aHl)
+ (@c_aHr)
+ ($dShow_aHs :: Show c_aHr)
+ (a_aBf :: Bool)
+ (b_aBg :: b_aHl)
+ (c_aBh :: c_aHr) ->
+ GHC.Base.augment
+ @Char
+ (\ (@b_aQg)
+ (c_aQh [OS=OneShot] :: Char -> b_aQg -> b_aQg)
+ (n_aQi [OS=OneShot] :: b_aQg) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQg
+ c_aQh
+ n_aQi
+ (case a_aBf of {
+ False -> GHC.Show.$fShowBool5;
+ True -> GHC.Show.$fShowBool4
+ }))
+ (GHC.Base.augment
+ @Char
+ (\ (@b_aQg)
+ (c_aQh [OS=OneShot] :: Char -> b_aQg -> b_aQg)
+ (n_aQi [OS=OneShot] :: b_aQg) ->
+ GHC.Base.foldr
+ @Char @b_aQg c_aQh n_aQi (show @b_aHl $dShow_aHm b_aBg))
+ (show @c_aHr $dShow_aHs c_aBh))
+end Rec }
+
+-- RHS size: {terms: 1, types: 0, coercions: 10, joins: 0/0}
+T17966.$fCBoolb [InlPrag=INLINE (sat-args=0)]
+ :: forall b. Show b => C Bool b
+[LclIdX[DFunId(nt)],
+ Arity=5,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=True)
+ Tmpl= $cm_aHo
+ `cast` (forall (b :: <*>_N).
+ <Show b>_R %<'Many>_N ->_R Sym (T17966.N:C[0] <Bool>_N <b>_N)
+ :: (forall {b} c. (Show b, Show c) => Bool -> b -> c -> String)
+ ~R# (forall {b}. Show b => C Bool b))}]
+T17966.$fCBoolb
+ = $cm_aHo
+ `cast` (forall (b :: <*>_N).
+ <Show b>_R %<'Many>_N ->_R Sym (T17966.N:C[0] <Bool>_N <b>_N)
+ :: (forall {b} c. (Show b, Show c) => Bool -> b -> c -> String)
+ ~R# (forall {b}. Show b => C Bool b))
+
+-- RHS size: {terms: 18, types: 15, coercions: 3, joins: 0/0}
+$sf_sRO [InlPrag=[0]] :: Bool -> () -> Maybe Integer -> [Char]
+[LclId, Arity=3]
+$sf_sRO
+ = \ (a_aBl :: Bool) (b_aBm :: ()) (c_aBn :: Maybe Integer) ->
+ GHC.Base.build
+ @Char
+ (\ (@b_aQz)
+ (c_aQA [OS=OneShot] :: Char -> b_aQz -> b_aQz)
+ (n_aQB [OS=OneShot] :: b_aQz) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQz
+ c_aQA
+ (GHC.CString.unpackFoldrCString# @b_aQz "!"# c_aQA n_aQB)
+ (($dC_sRM
+ `cast` (T17966.N:C[0] <Bool>_N <()>_N
+ :: C Bool () ~R# (forall c. Show c => Bool -> () -> c -> String)))
+ @(Maybe Integer) $dShow_sRN a_aBl b_aBm c_aBn))
+
+-- RHS size: {terms: 23, types: 21, coercions: 3, joins: 0/0}
+f [InlPrag=INLINABLE[0]]
+ :: forall a b c. (C a b, Show c) => a -> b -> c -> String
+[LclIdX,
+ Arity=5,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 0 0 0 0] 120 0
+ Tmpl= \ (@a_aFi)
+ (@b_aFj)
+ (@c_aFk)
+ ($dC_aFl [Occ=Once1] :: C a_aFi b_aFj)
+ ($dShow_aFm [Occ=Once1] :: Show c_aFk)
+ (a_aBl [Occ=Once1] :: a_aFi)
+ (b_aBm [Occ=Once1] :: b_aFj)
+ (c_aBn [Occ=Once1] :: c_aFk) ->
+ ++
+ @Char
+ (($dC_aFl
+ `cast` (T17966.N:C[0] <a_aFi>_N <b_aFj>_N
+ :: C a_aFi b_aFj
+ ~R# (forall c. Show c => a_aFi -> b_aFj -> c -> String)))
+ @c_aFk $dShow_aFm a_aBl b_aBm c_aBn)
+ (GHC.CString.unpackCString# "!"#)},
+ RULES: "SPEC f @Bool @() @(Maybe Integer)" [0]
+ forall ($dC_sRM :: C Bool ()) ($dShow_sRN :: Show (Maybe Integer)).
+ f @Bool @() @(Maybe Integer) $dC_sRM $dShow_sRN
+ = $sf_sRO]
+f = \ (@a_aFi)
+ (@b_aFj)
+ (@c_aFk)
+ ($dC_aFl :: C a_aFi b_aFj)
+ ($dShow_aFm :: Show c_aFk)
+ (a_aBl :: a_aFi)
+ (b_aBm :: b_aFj)
+ (c_aBn :: c_aFk) ->
+ GHC.Base.build
+ @Char
+ (\ (@b_aQz)
+ (c_aQA [OS=OneShot] :: Char -> b_aQz -> b_aQz)
+ (n_aQB [OS=OneShot] :: b_aQz) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQz
+ c_aQA
+ (GHC.CString.unpackFoldrCString# @b_aQz "!"# c_aQA n_aQB)
+ (($dC_aFl
+ `cast` (T17966.N:C[0] <a_aFi>_N <b_aFj>_N
+ :: C a_aFi b_aFj
+ ~R# (forall c. Show c => a_aFi -> b_aFj -> c -> String)))
+ @c_aFk $dShow_aFm a_aBl b_aBm c_aBn))
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$trModule_sRG :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+$trModule_sRG = "main"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$trModule_sRH :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$trModule_sRH = GHC.Types.TrNameS $trModule_sRG
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$trModule_sRI :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+$trModule_sRI = "T17966"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$trModule_sRJ :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$trModule_sRJ = GHC.Types.TrNameS $trModule_sRI
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+T17966.$trModule :: GHC.Types.Module
+[LclIdX,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T17966.$trModule = GHC.Types.Module $trModule_sRH $trModule_sRJ
+
+-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
+$krep_aPr [InlPrag=[~]] :: GHC.Types.KindRep
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$krep_aPr
+ = GHC.Types.KindRepTyConApp
+ GHC.Types.$tcConstraint (GHC.Types.[] @GHC.Types.KindRep)
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+$krep_aPq [InlPrag=[~]] :: GHC.Types.KindRep
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$krep_aPq = GHC.Types.KindRepFun GHC.Types.krep$* $krep_aPr
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+$krep_aPp [InlPrag=[~]] :: GHC.Types.KindRep
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$krep_aPp = GHC.Types.KindRepFun GHC.Types.krep$* $krep_aPq
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$tcC_sRK :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+$tcC_sRK = "C"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$tcC_sRL :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$tcC_sRL = GHC.Types.TrNameS $tcC_sRK
+
+-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
+T17966.$tcC :: GHC.Types.TyCon
+[LclIdX,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T17966.$tcC
+ = GHC.Types.TyCon
+ 12503088876068780286##64
+ 926716241154773768##64
+ T17966.$trModule
+ $tcC_sRL
+ 0#
+ $krep_aPp
+
+-- RHS size: {terms: 10, types: 7, coercions: 4, joins: 0/0}
+x :: String
+[LclIdX,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
+ WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 120 0}]
+x = f @Bool
+ @()
+ @(Maybe Integer)
+ (($cm_aHo @() GHC.Show.$fShow())
+ `cast` (Sym (T17966.N:C[0] <Bool>_N <()>_N)
+ :: (forall c. Show c => Bool -> () -> c -> String) ~R# C Bool ()))
+ (GHC.Show.$fShowMaybe @Integer GHC.Show.$fShowInteger)
+ GHC.Types.True
+ GHC.Tuple.()
+ (GHC.Maybe.Just @Integer (GHC.Num.Integer.IS 42#))
+
+
+
diff --git a/testsuite/tests/simplCore/should_compile/T19644.hs b/testsuite/tests/simplCore/should_compile/T19644.hs
new file mode 100644
index 0000000000..01f9f54f5e
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T19644.hs
@@ -0,0 +1,20 @@
+-- {-# OPTIONS_GHC -Wincomplete-patterns -fforce-recomp #-}
+-- {-# OPTIONS_GHC -O2 -fforce-recomp #-}
+-- {-# LANGUAGE PatternSynonyms #-}
+-- {-# LANGUAGE BangPatterns #-}
+-- {-# LANGUAGE MagicHash, UnboxedTuples #-}
+module T19644 where
+
+class C a where
+ m :: Show b => a -> b -> String
+ dummy :: a -> () -- Force a datatype dictionary representation
+
+instance C Int where
+ m a b = show a ++ show b
+ dummy _ = ()
+
+f :: (C a, Show b) => a -> b -> String
+f a b = m a b ++ "!"
+{-# INLINABLE[0] f #-}
+
+main = putStrLn (f (42::Int) (True::Bool))
diff --git a/testsuite/tests/simplCore/should_compile/T19644.stderr b/testsuite/tests/simplCore/should_compile/T19644.stderr
new file mode 100644
index 0000000000..e2c0e09e66
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T19644.stderr
@@ -0,0 +1,246 @@
+
+==================== Specialise ====================
+Result size of Specialise
+ = {terms: 134, types: 114, coercions: 3, joins: 0/0}
+
+-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
+$cdummy_aPi :: Int -> ()
+[LclId,
+ Arity=1,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]
+$cdummy_aPi = \ _ [Occ=Dead] -> GHC.Tuple.()
+
+-- RHS size: {terms: 17, types: 13, coercions: 0, joins: 0/0}
+$s$cm_sZO :: Int -> Bool -> [Char]
+[LclId, Arity=2]
+$s$cm_sZO
+ = \ (a_aBe :: Int) (b_aBf :: Bool) ->
+ GHC.Base.augment
+ @Char
+ (\ (@b_aQs)
+ (c_aQt [OS=OneShot] :: Char -> b_aQs -> b_aQs)
+ (n_aQu [OS=OneShot] :: b_aQs) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQs
+ c_aQt
+ n_aQu
+ (case a_aBe of { GHC.Types.I# n_aQz ->
+ GHC.Show.itos n_aQz (GHC.Types.[] @Char)
+ }))
+ (GHC.Show.$fShowBool_$cshow b_aBf)
+
+-- RHS size: {terms: 20, types: 17, coercions: 0, joins: 0/0}
+$cm_aP5 :: forall b. Show b => Int -> b -> String
+[LclId,
+ Arity=3,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [30 20 0] 130 40},
+ RULES: "SPEC $cm @Bool"
+ forall ($dShow_sZN :: Show Bool).
+ $cm_aP5 @Bool $dShow_sZN
+ = $s$cm_sZO]
+$cm_aP5
+ = \ (@b_aP8)
+ ($dShow_aP9 :: Show b_aP8)
+ (a_aBe :: Int)
+ (b_aBf :: b_aP8) ->
+ GHC.Base.augment
+ @Char
+ (\ (@b_aQs)
+ (c_aQt [OS=OneShot] :: Char -> b_aQs -> b_aQs)
+ (n_aQu [OS=OneShot] :: b_aQs) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQs
+ c_aQt
+ n_aQu
+ (case a_aBe of { GHC.Types.I# n_aQz ->
+ GHC.Show.itos n_aQz (GHC.Types.[] @Char)
+ }))
+ (show @b_aP8 $dShow_aP9 b_aBf)
+
+-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
+T19644.$fCInt [InlPrag=CONLIKE] :: C Int
+[LclIdX[DFunId],
+ Unf=DFun: \ -> T19644.C:C TYPE: Int $cm_aP5 $cdummy_aPi]
+T19644.$fCInt = T19644.C:C @Int $cm_aP5 $cdummy_aPi
+
+-- RHS size: {terms: 16, types: 12, coercions: 0, joins: 0/0}
+$sf_sZM [InlPrag=[0]] :: Int -> Bool -> [Char]
+[LclId, Arity=2]
+$sf_sZM
+ = \ (a_aBi :: Int) (b_aBj :: Bool) ->
+ GHC.Base.build
+ @Char
+ (\ (@b_aQT)
+ (c_aQU [OS=OneShot] :: Char -> b_aQT -> b_aQT)
+ (n_aQV [OS=OneShot] :: b_aQT) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQT
+ c_aQU
+ (GHC.CString.unpackFoldrCString# @b_aQT "!"# c_aQU n_aQV)
+ ($cm_aP5 @Bool GHC.Show.$fShowBool a_aBi b_aBj))
+
+-- RHS size: {terms: 21, types: 19, coercions: 0, joins: 0/0}
+f [InlPrag=INLINABLE[0]]
+ :: forall a b. (C a, Show b) => a -> b -> String
+[LclIdX,
+ Arity=4,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [30 0 0 0] 120 0
+ Tmpl= \ (@a_aOm)
+ (@b_aOn)
+ ($dC_aOo [Occ=Once1] :: C a_aOm)
+ ($dShow_aOp [Occ=Once1] :: Show b_aOn)
+ (a_aBi [Occ=Once1] :: a_aOm)
+ (b_aBj [Occ=Once1] :: b_aOn) ->
+ ++
+ @Char
+ (m @a_aOm $dC_aOo @b_aOn $dShow_aOp a_aBi b_aBj)
+ (GHC.CString.unpackCString# "!"#)},
+ RULES: "SPEC f @Int @Bool" [0]
+ forall ($dC_sZK :: C Int) ($dShow_sZL :: Show Bool).
+ f @Int @Bool $dC_sZK $dShow_sZL
+ = $sf_sZM]
+f = \ (@a_aOm)
+ (@b_aOn)
+ ($dC_aOo :: C a_aOm)
+ ($dShow_aOp :: Show b_aOn)
+ (a_aBi :: a_aOm)
+ (b_aBj :: b_aOn) ->
+ GHC.Base.build
+ @Char
+ (\ (@b_aQT)
+ (c_aQU [OS=OneShot] :: Char -> b_aQT -> b_aQT)
+ (n_aQV [OS=OneShot] :: b_aQT) ->
+ GHC.Base.foldr
+ @Char
+ @b_aQT
+ c_aQU
+ (GHC.CString.unpackFoldrCString# @b_aQT "!"# c_aQU n_aQV)
+ (m @a_aOm $dC_aOo @b_aOn $dShow_aOp a_aBi b_aBj))
+
+-- RHS size: {terms: 6, types: 2, coercions: 0, joins: 0/0}
+main_sZC :: String
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
+ WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 60 0}]
+main_sZC
+ = f @Int
+ @Bool
+ T19644.$fCInt
+ GHC.Show.$fShowBool
+ (GHC.Types.I# 42#)
+ GHC.Types.True
+
+-- RHS size: {terms: 4, types: 0, coercions: 0, joins: 0/0}
+main_sZD
+ :: GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
+[LclId,
+ Arity=1,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 60}]
+main_sZD
+ = GHC.IO.Handle.Text.hPutStr2
+ GHC.IO.Handle.FD.stdout main_sZC GHC.Types.True
+
+-- RHS size: {terms: 1, types: 0, coercions: 3, joins: 0/0}
+main :: IO ()
+[LclIdX,
+ Arity=1,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)}]
+main
+ = main_sZD
+ `cast` (Sym (GHC.Types.N:IO[0] <()>_R)
+ :: (GHC.Prim.State# GHC.Prim.RealWorld
+ -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
+ ~R# IO ())
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$trModule_sZE :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+$trModule_sZE = "main"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$trModule_sZF :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$trModule_sZF = GHC.Types.TrNameS $trModule_sZE
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$trModule_sZG :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+$trModule_sZG = "T19644"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$trModule_sZH :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$trModule_sZH = GHC.Types.TrNameS $trModule_sZG
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+T19644.$trModule :: GHC.Types.Module
+[LclIdX,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T19644.$trModule = GHC.Types.Module $trModule_sZF $trModule_sZH
+
+-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
+$krep_aPH [InlPrag=[~]] :: GHC.Types.KindRep
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$krep_aPH
+ = GHC.Types.KindRepTyConApp
+ GHC.Types.$tcConstraint (GHC.Types.[] @GHC.Types.KindRep)
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+$krep_aPG [InlPrag=[~]] :: GHC.Types.KindRep
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$krep_aPG = GHC.Types.KindRepFun GHC.Types.krep$* $krep_aPH
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$tcC_sZI :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+$tcC_sZI = "C"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$tcC_sZJ :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$tcC_sZJ = GHC.Types.TrNameS $tcC_sZI
+
+-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
+T19644.$tcC :: GHC.Types.TyCon
+[LclIdX,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+T19644.$tcC
+ = GHC.Types.TyCon
+ 3363473062474234294##64
+ 5379444656532611026##64
+ T19644.$trModule
+ $tcC_sZJ
+ 0#
+ $krep_aPG
+
+
+
diff --git a/testsuite/tests/simplCore/should_compile/T6056.stderr b/testsuite/tests/simplCore/should_compile/T6056.stderr
index 7706318b4d..461ba97c70 100644
--- a/testsuite/tests/simplCore/should_compile/T6056.stderr
+++ b/testsuite/tests/simplCore/should_compile/T6056.stderr
@@ -1,5 +1,4 @@
Rule fired: SPEC/T6056 $wsmallerAndRest @Int (T6056)
Rule fired: SPEC/T6056 $wsmallerAndRest @Int (T6056)
-Rule fired: Class op < (BUILTIN)
Rule fired: SPEC/T6056 $wsmallerAndRest @Int (T6056)
Rule fired: SPEC/T6056 $wsmallerAndRest @Int (T6056)
diff --git a/testsuite/tests/simplCore/should_compile/T7785.stderr b/testsuite/tests/simplCore/should_compile/T7785.stderr
index f0187fe958..f2f819f89a 100644
--- a/testsuite/tests/simplCore/should_compile/T7785.stderr
+++ b/testsuite/tests/simplCore/should_compile/T7785.stderr
@@ -1,8 +1,408 @@
-==================== Tidy Core rules ====================
-"SPEC shared @[]"
- forall ($dMyFunctor :: MyFunctor []) (irred :: Domain [] Int).
- shared @[] $dMyFunctor irred
- = bar_$sshared
+==================== Specialise ====================
+Result size of Specialise
+ = {terms: 293, types: 99, coercions: 11, joins: 0/2}
+
+-- RHS size: {terms: 5, types: 10, coercions: 0, joins: 0/0}
+$cmyfmap_aG0
+ :: forall a b. (Domain [] a, Domain [] b) => (a -> b) -> [a] -> [b]
+[LclId,
+ Arity=4,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=True)}]
+$cmyfmap_aG0
+ = \ (@a_aG3) (@b_aG4) _ [Occ=Dead] _ [Occ=Dead] ->
+ map @a_aG3 @b_aG4
+
+-- RHS size: {terms: 1, types: 0, coercions: 3, joins: 0/0}
+Foo.$fMyFunctor[] [InlPrag=CONLIKE] :: MyFunctor []
+[LclIdX[DFunId(nt)],
+ Arity=4,
+ Unf=DFun: \ -> Foo.C:MyFunctor TYPE: [] $cmyfmap_aG0]
+Foo.$fMyFunctor[]
+ = $cmyfmap_aG0
+ `cast` (Sym (Foo.N:MyFunctor[0] <[]>_N)
+ :: (forall a b.
+ (Domain [] a, Domain [] b) =>
+ (a -> b) -> [a] -> [b])
+ ~R# MyFunctor [])
+
+-- RHS size: {terms: 114, types: 12, coercions: 0, joins: 0/1}
+$sshared_sHu :: Domain [] Int => [Int] -> [Int]
+[LclId, Arity=1]
+$sshared_sHu
+ = \ (irred_azD :: Domain [] Int) ->
+ let {
+ f_sHt :: [Int] -> [Int]
+ [LclId]
+ f_sHt
+ = myfmap
+ @[]
+ Foo.$fMyFunctor[]
+ @Int
+ @Int
+ irred_azD
+ irred_azD
+ GHC.Num.$fNumInt_$cnegate } in
+ \ (x_X4N :: [Int]) ->
+ f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ (f_sHt
+ x_X4N))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+
+-- RHS size: {terms: 116, types: 16, coercions: 0, joins: 0/1}
+shared
+ :: forall (f :: * -> *).
+ (MyFunctor f, Domain f Int) =>
+ f Int -> f Int
+[LclIdX,
+ Arity=2,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=NEVER},
+ RULES: "SPEC shared @[]"
+ forall ($dMyFunctor_sHr :: MyFunctor []).
+ shared @[] $dMyFunctor_sHr
+ = $sshared_sHu]
+shared
+ = \ (@(f_azB :: * -> *))
+ ($dMyFunctor_azC :: MyFunctor f_azB)
+ (irred_azD :: Domain f_azB Int) ->
+ let {
+ f_sHq :: f_azB Int -> f_azB Int
+ [LclId]
+ f_sHq
+ = myfmap
+ @f_azB
+ $dMyFunctor_azC
+ @Int
+ @Int
+ irred_azD
+ irred_azD
+ GHC.Num.$fNumInt_$cnegate } in
+ \ (x_X4N :: f_azB Int) ->
+ f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ (f_sHq
+ x_X4N))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+
+-- RHS size: {terms: 8, types: 4, coercions: 4, joins: 0/0}
+foo :: [Int] -> [Int]
+[LclIdX,
+ Arity=1,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 60 0}]
+foo
+ = \ (xs_axd :: [Int]) ->
+ shared
+ @[]
+ Foo.$fMyFunctor[]
+ (GHC.Classes.(%%)
+ `cast` (Sub (Sym (Foo.D:R:Domain[]a[0] <Int>_N))
+ :: (() :: Constraint) ~R# Domain [] Int))
+ (GHC.Types.: @Int (GHC.Types.I# 0#) xs_axd)
+
+-- RHS size: {terms: 8, types: 4, coercions: 4, joins: 0/0}
+bar :: [Int] -> [Int]
+[LclIdX,
+ Arity=1,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 60 10}]
+bar
+ = \ (xs_axe :: [Int]) ->
+ GHC.Types.:
+ @Int
+ (GHC.Types.I# 0#)
+ (shared
+ @[]
+ Foo.$fMyFunctor[]
+ (GHC.Classes.(%%)
+ `cast` (Sub (Sym (Foo.D:R:Domain[]a[0] <Int>_N))
+ :: (() :: Constraint) ~R# Domain [] Int))
+ xs_axe)
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$trModule_sHj :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+$trModule_sHj = "main"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$trModule_sHk :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$trModule_sHk = GHC.Types.TrNameS $trModule_sHj
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$trModule_sHl :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+$trModule_sHl = "Foo"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$trModule_sHm :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$trModule_sHm = GHC.Types.TrNameS $trModule_sHl
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+Foo.$trModule :: GHC.Types.Module
+[LclIdX,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+Foo.$trModule = GHC.Types.Module $trModule_sHk $trModule_sHm
+
+-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
+$krep_aGA [InlPrag=[~]] :: GHC.Types.KindRep
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$krep_aGA
+ = GHC.Types.KindRepTyConApp
+ GHC.Types.$tcConstraint (GHC.Types.[] @GHC.Types.KindRep)
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+$krep_aGz [InlPrag=[~]] :: GHC.Types.KindRep
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$krep_aGz = GHC.Types.KindRepFun GHC.Types.krep$*Arr* $krep_aGA
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+$tcMyFunctor_sHn :: GHC.Prim.Addr#
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 0}]
+$tcMyFunctor_sHn = "MyFunctor"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+$tcMyFunctor_sHo :: GHC.Types.TrName
+[LclId,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+$tcMyFunctor_sHo = GHC.Types.TrNameS $tcMyFunctor_sHn
+
+-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
+Foo.$tcMyFunctor :: GHC.Types.TyCon
+[LclIdX,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+Foo.$tcMyFunctor
+ = GHC.Types.TyCon
+ 12837160846121910345##64
+ 787075802864859973##64
+ Foo.$trModule
+ $tcMyFunctor_sHo
+ 0#
+ $krep_aGz
+
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 8cdf5a5417..02a5de56c6 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -136,7 +136,9 @@ test('T5366',
test('T7796', [], makefile_test, ['T7796'])
test('T5550', omit_ways(prof_ways), compile, [''])
test('T7865', normal, makefile_test, ['T7865'])
-test('T7785', only_ways(['optasm']), compile, ['-ddump-rules'])
+# T7785: Check that we generate the specialising RULE. Might not be listed in
+# -ddump-rules because of Note [Trimming auto-rules], hence grep
+test('T7785', [ only_ways(['optasm']), grep_errmsg(r'RULE') ], compile, ['-ddump-spec'])
test('T7702',
[extra_files(['T7702plugin']),
pre_cmd('$MAKE -s --no-print-directory -C T7702plugin package.T7702 TOP={top}'),
@@ -308,9 +310,6 @@ test('T17901',
makefile_test, ['T17901'])
test('T17930', [ grep_errmsg(r'^\$sfoo') ], compile, ['-O -ddump-spec -dsuppress-uniques -dsuppress-idinfo'])
test('spec004', [ grep_errmsg(r'\$sfoo') ], compile, ['-O -ddump-spec -dsuppress-uniques'])
-test('T17966',
- normal,
- makefile_test, ['T17966'])
# NB: T17810: -fspecialise-aggressively
test('T17810', normal, multimod_compile, ['T17810', '-fspecialise-aggressively -dcore-lint -O -v0'])
test('T18013', normal, multimod_compile, ['T18013', '-v0 -O'])
@@ -399,3 +398,8 @@ test('T20040', [ grep_errmsg(r'ifoldl\''), expect_broken(20040) ], compile, ['-O
# Key here is that yes* become visibly trivial due to eta-reduction, while no* are not eta-reduced.
test('T21261', [ grep_errmsg(r'^(yes|no)') ], compile, ['-O -ddump-simpl -dno-typeable-binds -dsuppress-all -dsuppress-uniques'])
+
+# We expect to see a SPEC rule for $cm
+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'])