summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Dammers <tdammers@gmail.com>2019-07-10 10:34:40 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-08-15 22:13:13 -0400
commit95837c0f573dfa22d93895d4d1ad85d6c8dcbea0 (patch)
tree21af8f4b34e5092f0a9f0d3e9d28f560f972af04
parentca71d5514626dbfd74a3d9931c2ecbd02b5343bc (diff)
downloadhaskell-95837c0f573dfa22d93895d4d1ad85d6c8dcbea0.tar.gz
Add test cases for #16615
-rw-r--r--testsuite/tests/deSugar/should_compile/T16615.hs8
-rw-r--r--testsuite/tests/deSugar/should_compile/T16615.stderr34
-rw-r--r--testsuite/tests/deSugar/should_compile/T16615.stdout0
-rw-r--r--testsuite/tests/deSugar/should_compile/all.T1
4 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_compile/T16615.hs b/testsuite/tests/deSugar/should_compile/T16615.hs
new file mode 100644
index 0000000000..9a81b69bc7
--- /dev/null
+++ b/testsuite/tests/deSugar/should_compile/T16615.hs
@@ -0,0 +1,8 @@
+module T16615
+where
+
+f :: Int -> Bool
+f i = if i == 0 then True else g (pred i)
+
+g :: Int -> Bool
+g i = if i == 0 then False else f (pred i)
diff --git a/testsuite/tests/deSugar/should_compile/T16615.stderr b/testsuite/tests/deSugar/should_compile/T16615.stderr
new file mode 100644
index 0000000000..ba79cbf63c
--- /dev/null
+++ b/testsuite/tests/deSugar/should_compile/T16615.stderr
@@ -0,0 +1,34 @@
+
+==================== Desugar (after optimization) ====================
+Result size of Desugar (after optimization)
+ = {terms: 36, types: 13, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 5, types: 0, coercions: 0, joins: 0/0}
+T16615.$trModule :: GHC.Types.Module
+[LclIdX]
+T16615.$trModule
+ = GHC.Types.Module
+ (GHC.Types.TrNameS "main"#) (GHC.Types.TrNameS "T16615"#)
+
+Rec {
+-- RHS size: {terms: 14, types: 4, coercions: 0, joins: 0/0}
+g :: Int -> Bool
+[LclIdX]
+g = \ (i_a26O :: Int) ->
+ case == @ Int GHC.Classes.$fEqInt i_a26O (GHC.Types.I# 0#) of {
+ False -> f (pred @ Int GHC.Enum.$fEnumInt i_a26O);
+ True -> GHC.Types.False
+ }
+
+-- RHS size: {terms: 14, types: 4, coercions: 0, joins: 0/0}
+f [Occ=LoopBreaker] :: Int -> Bool
+[LclIdX]
+f = \ (i_aWp :: Int) ->
+ case == @ Int GHC.Classes.$fEqInt i_aWp (GHC.Types.I# 0#) of {
+ False -> g (pred @ Int GHC.Enum.$fEnumInt i_aWp);
+ True -> GHC.Types.True
+ }
+end Rec }
+
+
+
diff --git a/testsuite/tests/deSugar/should_compile/T16615.stdout b/testsuite/tests/deSugar/should_compile/T16615.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/deSugar/should_compile/T16615.stdout
diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T
index 38793419db..e678b3beca 100644
--- a/testsuite/tests/deSugar/should_compile/all.T
+++ b/testsuite/tests/deSugar/should_compile/all.T
@@ -107,3 +107,4 @@ test('T14773a', normal, compile, ['-Wincomplete-patterns'])
test('T14773b', normal, compile, ['-Wincomplete-patterns'])
test('T14815', [], makefile_test, ['T14815'])
test('T13208', [], makefile_test, ['T13208'])
+test('T16615', normal, compile, ['-ddump-ds'])