summaryrefslogtreecommitdiff
path: root/testsuite/tests/arityanal/should_compile
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2020-10-06 17:10:55 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-17 22:02:13 -0400
commit451455fd008500259f5d2207bdfdccf6dddb52c5 (patch)
tree210c5ab7d7c4f1b8cb3f37d96679748423284438 /testsuite/tests/arityanal/should_compile
parent6b3eb06af41b7385737fb3a602acdb95a76d2eba (diff)
downloadhaskell-451455fd008500259f5d2207bdfdccf6dddb52c5.tar.gz
Testsuite: Add dead arity analysis tests
We didn't seem to test these old tests at all, judging from their expected output.
Diffstat (limited to 'testsuite/tests/arityanal/should_compile')
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity00.hs6
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity00.stderr34
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity01.hs10
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity01.stderr70
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity02.hs7
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity02.stderr47
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity03.hs8
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity03.stderr38
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity04.hs7
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity04.stderr47
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity05.hs7
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity05.stderr48
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity06.hs5
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity06.stderr34
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity07.hs5
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity07.stderr29
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity08.hs5
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity08.stderr29
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity09.hs4
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity09.stderr38
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity10.hs8
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity10.stderr64
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity11.hs10
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity11.stderr135
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity12.hs5
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity13.hs9
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity13.stderr33
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity14.hs5
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity14.stderr54
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity15.hs5
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity15.stderr34
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity16.hs7
-rw-r--r--testsuite/tests/arityanal/should_compile/Arity16.stderr48
-rw-r--r--testsuite/tests/arityanal/should_compile/T18793.stderr27
-rw-r--r--testsuite/tests/arityanal/should_compile/all.T22
35 files changed, 917 insertions, 27 deletions
diff --git a/testsuite/tests/arityanal/should_compile/Arity00.hs b/testsuite/tests/arityanal/should_compile/Arity00.hs
new file mode 100644
index 0000000000..2499aa6f2c
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity00.hs
@@ -0,0 +1,6 @@
+module F0 where
+
+f0 :: Int -> Int -> Int -> Int
+f0 x y = if (x>0) then let v = x + y
+ in \z -> v+z
+ else \z-> 1
diff --git a/testsuite/tests/arityanal/should_compile/Arity00.stderr b/testsuite/tests/arityanal/should_compile/Arity00.stderr
new file mode 100644
index 0000000000..392e1eebc5
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity00.stderr
@@ -0,0 +1,34 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 29, types: 15, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+F0.f1 :: Int
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+F0.f1 = GHC.Types.I# 1#
+
+-- RHS size: {terms: 25, types: 10, coercions: 0, joins: 0/0}
+f0 :: Int -> Int -> Int -> Int
+[GblId,
+ Arity=3,
+ Str=<S,1*U(U)><L,1*U(U)><L,1*U(U)>,
+ Cpr=m1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (x [Occ=Once1!] :: Int) (y [Occ=Once1!] :: Int) (eta [Occ=Once1!] :: Int) ->
+ case x of { GHC.Types.I# x1 ->
+ case GHC.Prim.># x1 0# of {
+ __DEFAULT -> F0.f1;
+ 1# -> case y of { GHC.Types.I# y1 [Occ=Once1] -> case eta of { GHC.Types.I# y2 [Occ=Once1] -> GHC.Types.I# (GHC.Prim.+# (GHC.Prim.+# x1 y1) y2) } }
+ }
+ }}]
+f0
+ = \ (x :: Int) (y :: Int) (eta :: Int) ->
+ case x of { GHC.Types.I# x1 ->
+ case GHC.Prim.># x1 0# of {
+ __DEFAULT -> F0.f1;
+ 1# -> case y of { GHC.Types.I# y1 -> case eta of { GHC.Types.I# y2 -> GHC.Types.I# (GHC.Prim.+# (GHC.Prim.+# x1 y1) y2) } }
+ }
+ }
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity01.hs b/testsuite/tests/arityanal/should_compile/Arity01.hs
new file mode 100644
index 0000000000..71ccfe4d16
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity01.hs
@@ -0,0 +1,10 @@
+module F1 where
+
+f1 = let h1 n x = if x<n then let v = h1 n (x+1)
+ in \y -> v (x+y)
+ else \y -> y
+ in h1 5 1 5
+
+g = \x1-> \x2-> \x3-> \x4-> \x5-> x1+x2+x3+x4+x5
+s f = f 3
+h = s g 6 7 8
diff --git a/testsuite/tests/arityanal/should_compile/Arity01.stderr b/testsuite/tests/arityanal/should_compile/Arity01.stderr
new file mode 100644
index 0000000000..318fc799e0
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity01.stderr
@@ -0,0 +1,70 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 61, types: 45, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F1.f2 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F1.f2 = 1
+
+Rec {
+-- RHS size: {terms: 18, types: 4, coercions: 0, joins: 0/0}
+F1.f1_h1 [Occ=LoopBreaker] :: Integer -> Integer -> Integer -> Integer
+[GblId, Arity=3, Str=<S,U><S,U><S,U>, Unf=OtherCon []]
+F1.f1_h1
+ = \ (n :: Integer) (x :: Integer) (eta :: Integer) ->
+ case GHC.Num.Integer.integerCompare x n of {
+ __DEFAULT -> eta;
+ LT -> F1.f1_h1 n (GHC.Num.Integer.integerAdd x F1.f2) (GHC.Num.Integer.integerAdd x eta)
+ }
+end Rec }
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F1.f3 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F1.f3 = 5
+
+-- RHS size: {terms: 4, types: 0, coercions: 0, joins: 0/0}
+f1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 40 0}]
+f1 = F1.f1_h1 F1.f3 F1.f2 F1.f3
+
+-- RHS size: {terms: 14, types: 5, coercions: 0, joins: 0/0}
+g :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer
+[GblId,
+ Arity=5,
+ Str=<S,1*U><S,U><S,U><S,U><S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=5,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (x1 [Occ=Once1] :: Integer) (x2 [Occ=Once1] :: Integer) (x3 [Occ=Once1] :: Integer) (x4 [Occ=Once1] :: Integer) (x5 [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd x1 x2) x3) x4) x5}]
+g = \ (x1 :: Integer) (x2 :: Integer) (x3 :: Integer) (x4 :: Integer) (x5 :: Integer) -> GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd x1 x2) x3) x4) x5
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F1.s1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F1.s1 = 3
+
+-- RHS size: {terms: 8, types: 9, coercions: 0, joins: 0/0}
+s :: forall {t1} {t2}. Num t1 => (t1 -> t2) -> t2
+[GblId,
+ Arity=2,
+ Str=<L,1*U(A,A,A,A,A,A,1*C1(U))><C(S),1*C1(U)>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@t) (@t1) ($dNum [Occ=Once1] :: Num t) (f [Occ=Once1!] :: t -> t1) -> f (fromInteger @t $dNum F1.s1)}]
+s = \ (@t) (@t1) ($dNum :: Num t) (f :: t -> t1) -> f (fromInteger @t $dNum F1.s1)
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F1.h1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F1.h1 = 24
+
+-- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0}
+h :: Integer -> Integer
+[GblId,
+ Arity=1,
+ Str=<S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (x5 [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd F1.h1 x5}]
+h = \ (x5 :: Integer) -> GHC.Num.Integer.integerAdd F1.h1 x5
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity02.hs b/testsuite/tests/arityanal/should_compile/Arity02.hs
new file mode 100644
index 0000000000..39ddae0f06
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity02.hs
@@ -0,0 +1,7 @@
+module F2 where
+
+f2f = \h -> \x -> h x 0
+f2 = let g = \x -> \y -> if (x > 0)
+ then g (x-1) (x+y)
+ else y
+ in f2f g 5
diff --git a/testsuite/tests/arityanal/should_compile/Arity02.stderr b/testsuite/tests/arityanal/should_compile/Arity02.stderr
new file mode 100644
index 0000000000..3bcac9aacc
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity02.stderr
@@ -0,0 +1,47 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 35, types: 27, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F2.f1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F2.f1 = 0
+
+-- RHS size: {terms: 7, types: 8, coercions: 0, joins: 0/0}
+f2f :: forall {t1} {t2}. (t1 -> Integer -> t2) -> t1 -> t2
+[GblId,
+ Arity=2,
+ Str=<C(C(S)),1*C1(C1(U))><L,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=True)
+ Tmpl= \ (@t) (@t1) (h [Occ=Once1!] :: t -> Integer -> t1) (x [Occ=Once1] :: t) -> h x F2.f1}]
+f2f = \ (@t) (@t1) (h :: t -> Integer -> t1) (x :: t) -> h x F2.f1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+lvl :: Integer
+[GblId, Unf=OtherCon []]
+lvl = 1
+
+Rec {
+-- RHS size: {terms: 16, types: 3, coercions: 0, joins: 0/0}
+F2.f2_g [Occ=LoopBreaker] :: Integer -> Integer -> Integer
+[GblId, Arity=2, Str=<S,U><S,U>, Unf=OtherCon []]
+F2.f2_g
+ = \ (x :: Integer) (y :: Integer) ->
+ case GHC.Num.Integer.integerCompare x F2.f1 of {
+ __DEFAULT -> y;
+ GT -> F2.f2_g (GHC.Num.Integer.integerSub x lvl) (GHC.Num.Integer.integerAdd x y)
+ }
+end Rec }
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F2.f3 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F2.f3 = 5
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+f2 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
+f2 = F2.f2_g F2.f3 F2.f1
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity03.hs b/testsuite/tests/arityanal/should_compile/Arity03.hs
new file mode 100644
index 0000000000..a54f25b78e
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity03.hs
@@ -0,0 +1,8 @@
+module F3 where
+
+fac :: Int -> Int
+fac x = if (x==0) then 1
+ else x*fac (x-1)
+
+f3 = let v = fac
+ in \y -> v y
diff --git a/testsuite/tests/arityanal/should_compile/Arity03.stderr b/testsuite/tests/arityanal/should_compile/Arity03.stderr
new file mode 100644
index 0000000000..29432b7307
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity03.stderr
@@ -0,0 +1,38 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 29, types: 13, coercions: 0, joins: 0/0}
+
+Rec {
+-- RHS size: {terms: 15, types: 3, coercions: 0, joins: 0/0}
+F3.$wfac [InlPrag=NOUSERINLINE[2], Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int#
+[GblId, Arity=1, Str=<S,1*U>, Unf=OtherCon []]
+F3.$wfac
+ = \ (ww :: GHC.Prim.Int#) ->
+ case ww of wild {
+ __DEFAULT -> case F3.$wfac (GHC.Prim.-# wild 1#) of ww1 { __DEFAULT -> GHC.Prim.*# wild ww1 };
+ 0# -> 1#
+ }
+end Rec }
+
+-- RHS size: {terms: 10, types: 4, coercions: 0, joins: 0/0}
+fac [InlPrag=NOUSERINLINE[2]] :: Int -> Int
+[GblId,
+ Arity=1,
+ Str=<S(S),1*U(1*U)>,
+ Cpr=m1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (w [Occ=Once1!] :: Int) -> case w of { GHC.Types.I# ww1 [Occ=Once1] -> case F3.$wfac ww1 of ww2 [Occ=Once1] { __DEFAULT -> GHC.Types.I# ww2 } }}]
+fac = \ (w :: Int) -> case w of { GHC.Types.I# ww1 -> case F3.$wfac ww1 of ww2 { __DEFAULT -> GHC.Types.I# ww2 } }
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f3 :: Int -> Int
+[GblId,
+ Arity=1,
+ Str=<S(S),1*U(1*U)>,
+ Cpr=m1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
+ Tmpl= fac}]
+f3 = fac
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity04.hs b/testsuite/tests/arityanal/should_compile/Arity04.hs
new file mode 100644
index 0000000000..3c70acae4a
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity04.hs
@@ -0,0 +1,7 @@
+module F4 where
+
+f4h :: (Int -> Int) -> Int -> Int
+f4h f x = if x==0 then (f x)
+ else f4h f (x-1) -- + (f x)
+f4g = \y->y+1
+f4 = f4h f4g 9
diff --git a/testsuite/tests/arityanal/should_compile/Arity04.stderr b/testsuite/tests/arityanal/should_compile/Arity04.stderr
new file mode 100644
index 0000000000..5e05c7407d
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity04.stderr
@@ -0,0 +1,47 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 39, types: 24, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 8, types: 3, coercions: 0, joins: 0/0}
+f4g :: Int -> Int
+[GblId,
+ Arity=1,
+ Str=<S,1*U(U)>,
+ Cpr=m1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (y [Occ=Once1!] :: Int) -> case y of { GHC.Types.I# x [Occ=Once1] -> GHC.Types.I# (GHC.Prim.+# x 1#) }}]
+f4g = \ (y :: Int) -> case y of { GHC.Types.I# x -> GHC.Types.I# (GHC.Prim.+# x 1#) }
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+lvl :: Int
+[GblId, Unf=OtherCon []]
+lvl = GHC.Types.I# 0#
+
+Rec {
+-- RHS size: {terms: 13, types: 4, coercions: 0, joins: 0/0}
+F4.$wf4h [InlPrag=NOUSERINLINE[2], Occ=LoopBreaker] :: (Int -> Int) -> GHC.Prim.Int# -> Int
+[GblId, Arity=2, Str=<C(S),1*C1(U)><S,1*U>, Unf=OtherCon []]
+F4.$wf4h
+ = \ (w :: Int -> Int) (ww :: GHC.Prim.Int#) ->
+ case ww of wild {
+ __DEFAULT -> F4.$wf4h w (GHC.Prim.-# wild 1#);
+ 0# -> w lvl
+ }
+end Rec }
+
+-- RHS size: {terms: 8, types: 5, coercions: 0, joins: 0/0}
+f4h [InlPrag=NOUSERINLINE[2]] :: (Int -> Int) -> Int -> Int
+[GblId,
+ Arity=2,
+ Str=<C(S),1*C1(U)><S(S),1*U(1*U)>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (w [Occ=Once1] :: Int -> Int) (w1 [Occ=Once1!] :: Int) -> case w1 of { GHC.Types.I# ww1 [Occ=Once1] -> F4.$wf4h w ww1 }}]
+f4h = \ (w :: Int -> Int) (w1 :: Int) -> case w1 of { GHC.Types.I# ww1 -> F4.$wf4h w ww1 }
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+f4 :: Int
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
+f4 = F4.$wf4h f4g 9#
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity05.hs b/testsuite/tests/arityanal/should_compile/Arity05.hs
new file mode 100644
index 0000000000..7595866195
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity05.hs
@@ -0,0 +1,7 @@
+module F5 where
+
+-- result not satisfiable
+f5g h z = (h z) + 1
+f5h f x g = f x + f5g g x -- + (f (x+1))
+f5y = (\y -> y+1)
+f5 = f5h f5y 0 f5y
diff --git a/testsuite/tests/arityanal/should_compile/Arity05.stderr b/testsuite/tests/arityanal/should_compile/Arity05.stderr
new file mode 100644
index 0000000000..ccdba513af
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity05.stderr
@@ -0,0 +1,48 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 54, types: 99, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F5.f5g1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F5.f5g1 = 1
+
+-- RHS size: {terms: 12, types: 11, coercions: 0, joins: 0/0}
+f5g :: forall {a} {t}. Num a => (t -> a) -> t -> a
+[GblId,
+ Arity=3,
+ Str=<S(C(C(S))LLLLLL),U(1*C1(C1(U)),A,A,A,A,A,1*C1(U))><L,1*C1(U)><L,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@a) (@t) ($dNum :: Num a) (h [Occ=Once1!] :: t -> a) (z [Occ=Once1] :: t) -> + @a $dNum (h z) (fromInteger @a $dNum F5.f5g1)}]
+f5g = \ (@a) (@t) ($dNum :: Num a) (h :: t -> a) (z :: t) -> + @a $dNum (h z) (fromInteger @a $dNum F5.f5g1)
+
+-- RHS size: {terms: 15, types: 14, coercions: 0, joins: 0/0}
+F5.$wf5h [InlPrag=NOUSERINLINE[2]] :: forall {a} {t}. (a -> a -> a) -> (Integer -> a) -> (t -> a) -> t -> (t -> a) -> a
+[GblId, Arity=5, Str=<C(C(S)),C(C1(U))><L,1*C1(U)><L,1*C1(U)><L,U><L,1*C1(U)>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 60 60 0 60] 120 0}]
+F5.$wf5h = \ (@a) (@t) (ww :: a -> a -> a) (ww1 :: Integer -> a) (w :: t -> a) (w1 :: t) (w2 :: t -> a) -> ww (w w1) (ww (w2 w1) (ww1 F5.f5g1))
+
+-- RHS size: {terms: 15, types: 32, coercions: 0, joins: 0/0}
+f5h [InlPrag=NOUSERINLINE[2]] :: forall {a} {t}. Num a => (t -> a) -> t -> (t -> a) -> a
+[GblId,
+ Arity=4,
+ Str=<S(C(C(S))LLLLLL),1*U(C(C1(U)),A,A,A,A,A,1*C1(U))><L,1*C1(U)><L,U><L,1*C1(U)>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@a) (@t) (w [Occ=Once1!] :: Num a) (w1 [Occ=Once1] :: t -> a) (w2 [Occ=Once1] :: t) (w3 [Occ=Once1] :: t -> a) -> case w of { GHC.Num.C:Num ww1 [Occ=Once1] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] ww7 [Occ=Once1] -> F5.$wf5h @a @t ww1 ww7 w1 w2 w3 }}]
+f5h = \ (@a) (@t) (w :: Num a) (w1 :: t -> a) (w2 :: t) (w3 :: t -> a) -> case w of { GHC.Num.C:Num ww1 ww2 ww3 ww4 ww5 ww6 ww7 -> F5.$wf5h @a @t ww1 ww7 w1 w2 w3 }
+
+-- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0}
+f5y :: Integer -> Integer
+[GblId,
+ Arity=1,
+ Str=<S,1*U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (y [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd y F5.f5g1}]
+f5y = \ (y :: Integer) -> GHC.Num.Integer.integerAdd y F5.f5g1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f5 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+f5 = 3
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity06.hs b/testsuite/tests/arityanal/should_compile/Arity06.hs
new file mode 100644
index 0000000000..b45951d6a2
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity06.hs
@@ -0,0 +1,5 @@
+module F6 where
+
+f6f = \h -> \x -> h x 0
+f6t = \y -> \z -> y + z
+f6 = f6f f6t 3
diff --git a/testsuite/tests/arityanal/should_compile/Arity06.stderr b/testsuite/tests/arityanal/should_compile/Arity06.stderr
new file mode 100644
index 0000000000..50a1ddc76b
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity06.stderr
@@ -0,0 +1,34 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 14, types: 22, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F6.f6f1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F6.f6f1 = 0
+
+-- RHS size: {terms: 7, types: 8, coercions: 0, joins: 0/0}
+f6f :: forall {t1} {t2}. (t1 -> Integer -> t2) -> t1 -> t2
+[GblId,
+ Arity=2,
+ Str=<C(C(S)),1*C1(C1(U))><L,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=True)
+ Tmpl= \ (@t) (@t1) (h [Occ=Once1!] :: t -> Integer -> t1) (x [Occ=Once1] :: t) -> h x F6.f6f1}]
+f6f = \ (@t) (@t1) (h :: t -> Integer -> t1) (x :: t) -> h x F6.f6f1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f6t :: Integer -> Integer -> Integer
+[GblId,
+ Arity=2,
+ Str=<S,1*U><S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
+ Tmpl= GHC.Num.Integer.integerAdd}]
+f6t = GHC.Num.Integer.integerAdd
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f6 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+f6 = 3
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity07.hs b/testsuite/tests/arityanal/should_compile/Arity07.hs
new file mode 100644
index 0000000000..fb68ada9c2
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity07.hs
@@ -0,0 +1,5 @@
+module F7 where
+
+f7f = \x -> x
+f7g = \z -> \y -> z+y
+f7 = f7f f7g 2 3
diff --git a/testsuite/tests/arityanal/should_compile/Arity07.stderr b/testsuite/tests/arityanal/should_compile/Arity07.stderr
new file mode 100644
index 0000000000..3a1852e017
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity07.stderr
@@ -0,0 +1,29 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 8, types: 11, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0}
+f7f :: forall {p}. p -> p
+[GblId,
+ Arity=1,
+ Str=<S,1*U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
+ Tmpl= \ (@p) (x [Occ=Once1] :: p) -> x}]
+f7f = \ (@p) (x :: p) -> x
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f7g :: Integer -> Integer -> Integer
+[GblId,
+ Arity=2,
+ Str=<S,1*U><S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
+ Tmpl= GHC.Num.Integer.integerAdd}]
+f7g = GHC.Num.Integer.integerAdd
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f7 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+f7 = 5
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity08.hs b/testsuite/tests/arityanal/should_compile/Arity08.hs
new file mode 100644
index 0000000000..6abb2b87e9
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity08.hs
@@ -0,0 +1,5 @@
+module F8 where
+
+f8f b x y = let g = \z -> x+y+z
+ in if b then y else g (x*x)
+f8 = f8f True 1 2
diff --git a/testsuite/tests/arityanal/should_compile/Arity08.stderr b/testsuite/tests/arityanal/should_compile/Arity08.stderr
new file mode 100644
index 0000000000..1f2f6c0fa4
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity08.stderr
@@ -0,0 +1,29 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 23, types: 20, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 20, types: 11, coercions: 0, joins: 0/0}
+f8f :: forall {p}. Num p => Bool -> p -> p -> p
+[GblId,
+ Arity=4,
+ Str=<L,U(C(C1(U)),A,1*C1(C1(U)),A,A,A,A)><S,1*U><L,U><L,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@p) ($dNum :: Num p) (b [Occ=Once1!] :: Bool) (x :: p) (y [Occ=Once2] :: p) ->
+ case b of {
+ False -> + @p $dNum (+ @p $dNum x y) (* @p $dNum x x);
+ True -> y
+ }}]
+f8f
+ = \ (@p) ($dNum :: Num p) (b :: Bool) (x :: p) (y :: p) ->
+ case b of {
+ False -> + @p $dNum (+ @p $dNum x y) (* @p $dNum x x);
+ True -> y
+ }
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f8 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+f8 = 2
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity09.hs b/testsuite/tests/arityanal/should_compile/Arity09.hs
new file mode 100644
index 0000000000..1d53d89174
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity09.hs
@@ -0,0 +1,4 @@
+module F9 where
+
+f91 = let f = \n -> if n<=100 then f (f (n+11)) else n-10
+ in f 10
diff --git a/testsuite/tests/arityanal/should_compile/Arity09.stderr b/testsuite/tests/arityanal/should_compile/Arity09.stderr
new file mode 100644
index 0000000000..580483309f
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity09.stderr
@@ -0,0 +1,38 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 25, types: 8, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+lvl :: Integer
+[GblId, Unf=OtherCon []]
+lvl = 100
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+lvl1 :: Integer
+[GblId, Unf=OtherCon []]
+lvl1 = 11
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F9.f1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F9.f1 = 10
+
+Rec {
+-- RHS size: {terms: 15, types: 2, coercions: 0, joins: 0/0}
+F9.f91_f [Occ=LoopBreaker] :: Integer -> Integer
+[GblId, Arity=1, Str=<S,U>, Unf=OtherCon []]
+F9.f91_f
+ = \ (n :: Integer) ->
+ case GHC.Num.Integer.integerCompare n lvl of {
+ __DEFAULT -> F9.f91_f (F9.f91_f (GHC.Num.Integer.integerAdd n lvl1));
+ GT -> GHC.Num.Integer.integerSub n F9.f1
+ }
+end Rec }
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+f91 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 20 0}]
+f91 = F9.f91_f F9.f1
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity10.hs b/testsuite/tests/arityanal/should_compile/Arity10.hs
new file mode 100644
index 0000000000..12d4009a53
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity10.hs
@@ -0,0 +1,8 @@
+module F10 where
+
+f10f = \h -> (h 1 2, h 3)
+f10g = \x -> \y -> x+y
+f10h = f10f f10g
+f10x1 = fst f10h
+f10x2 = snd f10h
+f10 = f10x2 f10x1
diff --git a/testsuite/tests/arityanal/should_compile/Arity10.stderr b/testsuite/tests/arityanal/should_compile/Arity10.stderr
new file mode 100644
index 0000000000..3c527026ec
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity10.stderr
@@ -0,0 +1,64 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 28, types: 34, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F10.f10f3 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F10.f10f3 = 1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F10.f10f2 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F10.f10f2 = 2
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F10.f10f1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F10.f10f1 = 3
+
+-- RHS size: {terms: 8, types: 8, coercions: 0, joins: 0/0}
+f10f :: forall {a}. (Integer -> Integer -> a) -> (a, Integer -> a)
+[GblId,
+ Arity=1,
+ Str=<L,C(U)>,
+ Cpr=m1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@a) (h :: Integer -> Integer -> a) -> (h F10.f10f3 F10.f10f2, h F10.f10f1)}]
+f10f = \ (@a) (h :: Integer -> Integer -> a) -> (h F10.f10f3 F10.f10f2, h F10.f10f1)
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f10g :: Integer -> Integer -> Integer
+[GblId,
+ Arity=2,
+ Str=<S,1*U><S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
+ Tmpl= GHC.Num.Integer.integerAdd}]
+f10g = GHC.Num.Integer.integerAdd
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f10x1 :: Integer
+[GblId, 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)}]
+f10x1 = F10.f10f1
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+f10x2 :: Integer -> Integer
+[GblId,
+ Arity=1,
+ Str=<S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (eta [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd F10.f10f1 eta}]
+f10x2 = GHC.Num.Integer.integerAdd F10.f10f1
+
+-- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0}
+f10h :: (Integer, Integer -> Integer)
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+f10h = (F10.f10f1, f10x2)
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f10 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+f10 = 6
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity11.hs b/testsuite/tests/arityanal/should_compile/Arity11.hs
new file mode 100644
index 0000000000..9fd32c2fb5
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity11.hs
@@ -0,0 +1,10 @@
+module F11 where
+
+fib 0 = 1
+fib 1 = 1
+fib n = fib (n-1) + fib (n-2)
+
+f11f = \z -> let x = fib 1000
+ in \y -> x+y
+
+f11 = (f11f 5 6, f11f 7 8)
diff --git a/testsuite/tests/arityanal/should_compile/Arity11.stderr b/testsuite/tests/arityanal/should_compile/Arity11.stderr
new file mode 100644
index 0000000000..243632ea06
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity11.stderr
@@ -0,0 +1,135 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 129, types: 104, coercions: 0, joins: 0/5}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F11.fib1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F11.fib1 = 0
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F11.fib3 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F11.fib3 = 1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F11.fib2 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F11.fib2 = 2
+
+Rec {
+-- RHS size: {terms: 24, types: 3, coercions: 0, joins: 0/0}
+F11.f11_fib [Occ=LoopBreaker] :: Integer -> Integer
+[GblId, Arity=1, Str=<S,U>, Unf=OtherCon []]
+F11.f11_fib
+ = \ (ds :: Integer) ->
+ case GHC.Num.Integer.integerEq# ds F11.fib1 of {
+ __DEFAULT ->
+ case GHC.Num.Integer.integerEq# ds F11.fib3 of {
+ __DEFAULT -> GHC.Num.Integer.integerAdd (F11.f11_fib (GHC.Num.Integer.integerSub ds F11.fib3)) (F11.f11_fib (GHC.Num.Integer.integerSub ds F11.fib2));
+ 1# -> F11.fib3
+ };
+ 1# -> F11.fib3
+ }
+end Rec }
+
+-- RHS size: {terms: 52, types: 28, coercions: 0, joins: 0/5}
+F11.$wfib [InlPrag=NOUSERINLINE[2]] :: forall {a} {p}. (a -> a -> Bool) -> (Num a, Num p) => a -> p
+[GblId, Arity=4, Str=<C(C(S)),C(C1(U))><L,U(A,C(C1(U)),A,A,A,A,C(U))><L,U(C(C1(U)),A,A,A,A,A,1*C1(U))><L,U>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 150 60 0] 460 0}]
+F11.$wfib
+ = \ (@a) (@p) (ww :: a -> a -> Bool) (w :: Num a) (w1 :: Num p) (w2 :: a) ->
+ let {
+ lvl :: a
+ [LclId]
+ lvl = fromInteger @a w F11.fib3 } in
+ let {
+ lvl1 :: a
+ [LclId]
+ lvl1 = fromInteger @a w F11.fib2 } in
+ let {
+ lvl2 :: p
+ [LclId]
+ lvl2 = fromInteger @p w1 F11.fib3 } in
+ let {
+ lvl3 :: a
+ [LclId]
+ lvl3 = fromInteger @a w F11.fib1 } in
+ letrec {
+ fib4 [Occ=LoopBreaker] :: a -> p
+ [LclId, Arity=1, Str=<L,U>, Unf=OtherCon []]
+ fib4
+ = \ (ds :: a) ->
+ case ww ds lvl3 of {
+ False ->
+ case ww ds lvl of {
+ False -> + @p w1 (fib4 (- @a w ds lvl)) (fib4 (- @a w ds lvl1));
+ True -> lvl2
+ };
+ True -> lvl2
+ }; } in
+ fib4 w2
+
+-- RHS size: {terms: 14, types: 21, coercions: 0, joins: 0/0}
+fib [InlPrag=NOUSERINLINE[2]] :: forall {a} {p}. (Eq a, Num a, Num p) => a -> p
+[GblId,
+ Arity=4,
+ Str=<S(C(C(S))L),1*U(C(C1(U)),A)><L,U(A,C(C1(U)),A,A,A,A,C(U))><L,U(C(C1(U)),A,A,A,A,A,C(U))><L,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@a) (@p) (w [Occ=Once1!] :: Eq a) (w1 [Occ=Once1] :: Num a) (w2 [Occ=Once1] :: Num p) (w3 [Occ=Once1] :: a) -> case w of { GHC.Classes.C:Eq ww1 [Occ=Once1] _ [Occ=Dead] -> F11.$wfib @a @p ww1 w1 w2 w3 }}]
+fib = \ (@a) (@p) (w :: Eq a) (w1 :: Num a) (w2 :: Num p) (w3 :: a) -> case w of { GHC.Classes.C:Eq ww1 ww2 -> F11.$wfib @a @p ww1 w1 w2 w3 }
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F11.f3 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F11.f3 = 1000
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+F11.f11_x :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 20 0}]
+F11.f11_x = F11.f11_fib F11.f3
+
+-- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0}
+F11.f11f1 :: Integer -> Integer
+[GblId,
+ Arity=1,
+ Str=<S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (y [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd F11.f11_x y}]
+F11.f11f1 = \ (y :: Integer) -> GHC.Num.Integer.integerAdd F11.f11_x y
+
+-- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0}
+f11f :: forall {p}. p -> Integer -> Integer
+[GblId,
+ Arity=2,
+ Str=<L,A><S,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
+ Tmpl= \ (@p) _ [Occ=Dead] (eta [Occ=Once1] :: Integer) -> F11.f11f1 eta}]
+f11f = \ (@p) _ [Occ=Dead] -> F11.f11f1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F11.f5 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F11.f5 = 6
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+F11.f4 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
+F11.f4 = GHC.Num.Integer.integerAdd F11.f11_x F11.f5
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F11.f2 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F11.f2 = 8
+
+-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
+F11.f1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
+F11.f1 = GHC.Num.Integer.integerAdd F11.f11_x F11.f2
+
+-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
+f11 :: (Integer, Integer)
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+f11 = (F11.f4, F11.f1)
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity12.hs b/testsuite/tests/arityanal/should_compile/Arity12.hs
new file mode 100644
index 0000000000..dfc043b84c
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity12.hs
@@ -0,0 +1,5 @@
+module F12 where
+
+f12 = let f g x = g x
+ h = (+)
+ in f h 4 5
diff --git a/testsuite/tests/arityanal/should_compile/Arity13.hs b/testsuite/tests/arityanal/should_compile/Arity13.hs
new file mode 100644
index 0000000000..bcf87f53e4
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity13.hs
@@ -0,0 +1,9 @@
+module F13 where
+
+f13 :: Int -> Int -> Int -> Int
+f13 x y = let f13f = if (x>0) then \z -> z x y
+ else \z -> y
+ f13h = let v = f13f (*)
+ in \w -> w + v
+ in \u -> f13h u
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity13.stderr b/testsuite/tests/arityanal/should_compile/Arity13.stderr
new file mode 100644
index 0000000000..88f55bda2d
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity13.stderr
@@ -0,0 +1,33 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 32, types: 16, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 31, types: 12, coercions: 0, joins: 0/0}
+f13 :: Int -> Int -> Int -> Int
+[GblId,
+ Arity=3,
+ Str=<S,1*U(U)><S,1*U(U)><S,1*U(U)>,
+ Cpr=m1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (x [Occ=Once1!] :: Int) (y [Occ=Once2!] :: Int) (eta [Occ=Once1!] :: Int) ->
+ case eta of { GHC.Types.I# x1 [Occ=Once2] ->
+ case x of { GHC.Types.I# x2 ->
+ case GHC.Prim.># x2 0# of {
+ __DEFAULT -> case y of { GHC.Types.I# y1 [Occ=Once1] -> GHC.Types.I# (GHC.Prim.+# x1 y1) };
+ 1# -> case y of { GHC.Types.I# y1 [Occ=Once1] -> GHC.Types.I# (GHC.Prim.+# x1 (GHC.Prim.*# x2 y1)) }
+ }
+ }
+ }}]
+f13
+ = \ (x :: Int) (y :: Int) (eta :: Int) ->
+ case eta of { GHC.Types.I# x1 ->
+ case x of { GHC.Types.I# x2 ->
+ case GHC.Prim.># x2 0# of {
+ __DEFAULT -> case y of { GHC.Types.I# y1 -> GHC.Types.I# (GHC.Prim.+# x1 y1) };
+ 1# -> case y of { GHC.Types.I# y1 -> GHC.Types.I# (GHC.Prim.+# x1 (GHC.Prim.*# x2 y1)) }
+ }
+ }
+ }
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity14.hs b/testsuite/tests/arityanal/should_compile/Arity14.hs
new file mode 100644
index 0000000000..1f2c19ed92
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity14.hs
@@ -0,0 +1,5 @@
+module F14 where
+
+f14 n x = if x<n then let v = f14 n (x+1)
+ in \y -> v (x+y)
+ else \y -> y
diff --git a/testsuite/tests/arityanal/should_compile/Arity14.stderr b/testsuite/tests/arityanal/should_compile/Arity14.stderr
new file mode 100644
index 0000000000..1d4ea800e6
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity14.stderr
@@ -0,0 +1,54 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 56, types: 87, coercions: 0, joins: 0/3}
+
+-- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0}
+F14.f1 :: forall {t}. t -> t
+[GblId,
+ Arity=1,
+ Str=<S,1*U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
+ Tmpl= \ (@t) (y [Occ=Once1] :: t) -> y}]
+F14.f1 = \ (@t) (y :: t) -> y
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F14.f2 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F14.f2 = 1
+
+-- RHS size: {terms: 35, types: 24, coercions: 0, joins: 0/3}
+F14.$wf14 [InlPrag=NOUSERINLINE[2]] :: forall {t}. (t -> t -> Bool) -> Num t => t -> t -> t -> t
+[GblId, Arity=4, Str=<C(C(S)),C(C1(U))><L,U(C(C1(U)),A,A,A,A,A,1*C1(U))><L,U><L,U>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 90 0 0] 300 0}]
+F14.$wf14
+ = \ (@t) (ww :: t -> t -> Bool) (w :: Num t) (w1 :: t) (w2 :: t) ->
+ let {
+ lvl :: t
+ [LclId]
+ lvl = fromInteger @t w F14.f2 } in
+ letrec {
+ f3 [Occ=LoopBreaker] :: t -> t -> t -> t
+ [LclId, Arity=2, Str=<L,U><L,U>, Unf=OtherCon []]
+ f3
+ = \ (n :: t) (x :: t) ->
+ case ww x n of {
+ False -> F14.f1 @t;
+ True ->
+ let {
+ v [Dmd=<L,C(U)>] :: t -> t
+ [LclId]
+ v = f3 n (+ @t w x lvl) } in
+ \ (y :: t) -> v (+ @t w x y)
+ }; } in
+ f3 w1 w2
+
+-- RHS size: {terms: 13, types: 34, coercions: 0, joins: 0/0}
+f14 [InlPrag=NOUSERINLINE[2]] :: forall {t}. (Ord t, Num t) => t -> t -> t -> t
+[GblId,
+ Arity=4,
+ Str=<S(LLC(C(S))LLLLL),1*U(A,A,C(C1(U)),A,A,A,A,A)><L,U(C(C1(U)),A,A,A,A,A,C(U))><L,U><L,U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@t) (w [Occ=Once1!] :: Ord t) (w1 [Occ=Once1] :: Num t) (w2 [Occ=Once1] :: t) (w3 [Occ=Once1] :: t) -> case w of { GHC.Classes.C:Ord _ [Occ=Dead] _ [Occ=Dead] ww3 [Occ=Once1] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] -> F14.$wf14 @t ww3 w1 w2 w3 }}]
+f14 = \ (@t) (w :: Ord t) (w1 :: Num t) (w2 :: t) (w3 :: t) -> case w of { GHC.Classes.C:Ord ww1 ww2 ww3 ww4 ww5 ww6 ww7 ww8 -> F14.$wf14 @t ww3 w1 w2 w3 }
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity15.hs b/testsuite/tests/arityanal/should_compile/Arity15.hs
new file mode 100644
index 0000000000..0ad77e3a3f
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity15.hs
@@ -0,0 +1,5 @@
+module F15 where
+
+f15f = \h -> h 1
+f15g = \x -> x+1
+f15 = f15f f15g
diff --git a/testsuite/tests/arityanal/should_compile/Arity15.stderr b/testsuite/tests/arityanal/should_compile/Arity15.stderr
new file mode 100644
index 0000000000..4034be6198
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity15.stderr
@@ -0,0 +1,34 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 14, types: 14, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+F15.f15f1 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+F15.f15f1 = 1
+
+-- RHS size: {terms: 4, types: 4, coercions: 0, joins: 0/0}
+f15f :: forall {t}. (Integer -> t) -> t
+[GblId,
+ Arity=1,
+ Str=<C(S),1*C1(U)>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
+ Tmpl= \ (@t) (h [Occ=Once1!] :: Integer -> t) -> h F15.f15f1}]
+f15f = \ (@t) (h :: Integer -> t) -> h F15.f15f1
+
+-- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0}
+f15g :: Integer -> Integer
+[GblId,
+ Arity=1,
+ Str=<S,1*U>,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
+ Tmpl= \ (x [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd x F15.f15f1}]
+f15g = \ (x :: Integer) -> GHC.Num.Integer.integerAdd x F15.f15f1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+f15 :: Integer
+[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
+f15 = 2
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/Arity16.hs b/testsuite/tests/arityanal/should_compile/Arity16.hs
new file mode 100644
index 0000000000..b5a854cb4d
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity16.hs
@@ -0,0 +1,7 @@
+module Prim where
+
+map2 f [] = []
+map2 f (x:xs) = f x : map2 f xs
+
+zipWith2 f [] [] = []
+zipWith2 f (a:x) (b:y) = (f a b):zipWith2 f x y
diff --git a/testsuite/tests/arityanal/should_compile/Arity16.stderr b/testsuite/tests/arityanal/should_compile/Arity16.stderr
new file mode 100644
index 0000000000..6c9d7f61f8
--- /dev/null
+++ b/testsuite/tests/arityanal/should_compile/Arity16.stderr
@@ -0,0 +1,48 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 52, types: 87, coercions: 0, joins: 0/0}
+
+Rec {
+-- RHS size: {terms: 15, types: 17, coercions: 0, joins: 0/0}
+map2 [Occ=LoopBreaker] :: forall {t} {a}. (t -> a) -> [t] -> [a]
+[GblId, Arity=2, Str=<L,C(U)><S,1*U>, Unf=OtherCon []]
+map2
+ = \ (@t) (@a) (f :: t -> a) (ds :: [t]) ->
+ case ds of {
+ [] -> GHC.Types.[] @a;
+ : x xs -> GHC.Types.: @a (f x) (map2 @t @a f xs)
+ }
+end Rec }
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+lvl :: GHC.Prim.Addr#
+[GblId, Unf=OtherCon []]
+lvl = "Arity16.hs:(6,1)-(7,47)|function zipWith2"#
+
+-- RHS size: {terms: 3, types: 5, coercions: 0, joins: 0/0}
+lvl1 :: forall {a}. [a]
+[GblId, Str=b, Cpr=b]
+lvl1 = \ (@a) -> Control.Exception.Base.patError @'GHC.Types.LiftedRep @[a] lvl
+
+Rec {
+-- RHS size: {terms: 29, types: 35, coercions: 0, joins: 0/0}
+zipWith2 [Occ=LoopBreaker] :: forall {t1} {t2} {a}. (t1 -> t2 -> a) -> [t1] -> [t2] -> [a]
+[GblId, Arity=3, Str=<L,C(C1(U))><S,1*U><S,1*U>, Unf=OtherCon []]
+zipWith2
+ = \ (@t) (@t1) (@a) (f :: t -> t1 -> a) (ds :: [t]) (ds1 :: [t1]) ->
+ case ds of {
+ [] ->
+ case ds1 of {
+ [] -> GHC.Types.[] @a;
+ : ipv ipv1 -> lvl1 @a
+ };
+ : a1 x ->
+ case ds1 of {
+ [] -> lvl1 @a;
+ : b y -> GHC.Types.: @a (f a1 b) (zipWith2 @t @t1 @a f x y)
+ }
+ }
+end Rec }
+
+
+
diff --git a/testsuite/tests/arityanal/should_compile/T18793.stderr b/testsuite/tests/arityanal/should_compile/T18793.stderr
index 72fc5e4e19..60b2fd784d 100644
--- a/testsuite/tests/arityanal/should_compile/T18793.stderr
+++ b/testsuite/tests/arityanal/should_compile/T18793.stderr
@@ -1,31 +1,6 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 95, types: 79, coercions: 0, joins: 0/0}
-
--- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T18793.$trModule4 :: GHC.Prim.Addr#
-[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
-T18793.$trModule4 = "main"#
-
--- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T18793.$trModule3 :: GHC.Types.TrName
-[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
-T18793.$trModule3 = GHC.Types.TrNameS T18793.$trModule4
-
--- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T18793.$trModule2 :: GHC.Prim.Addr#
-[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
-T18793.$trModule2 = "T18793"#
-
--- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T18793.$trModule1 :: GHC.Types.TrName
-[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
-T18793.$trModule1 = GHC.Types.TrNameS T18793.$trModule2
-
--- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T18793.$trModule :: GHC.Types.Module
-[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
-T18793.$trModule = GHC.Types.Module T18793.$trModule3 T18793.$trModule1
+Result size of Tidy Core = {terms: 81, types: 74, coercions: 0, joins: 0/0}
-- RHS size: {terms: 20, types: 13, coercions: 0, joins: 0/0}
T18793.$wstuff [InlPrag=NOINLINE] :: Int -> (# Int, [Int] #)
diff --git a/testsuite/tests/arityanal/should_compile/all.T b/testsuite/tests/arityanal/should_compile/all.T
index ed1047ba00..3413a3270c 100644
--- a/testsuite/tests/arityanal/should_compile/all.T
+++ b/testsuite/tests/arityanal/should_compile/all.T
@@ -1 +1,21 @@
-test('T18793', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+# "Unit tests"
+test('Arity00', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity01', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity02', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity03', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity04', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity05', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity06', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity07', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity08', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity09', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity10', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity11', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity12', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity13', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity14', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity15', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+test('Arity16', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])
+
+# Regression tests
+test('T18793', [ only_ways(['optasm']), grep_errmsg('Arity=') ], compile, ['-dno-typeable-binds -ddump-simpl -dppr-cols=99999 -dsuppress-uniques'])