[commit: ghc] master: Add a test for #11272 (70191f5)

git at git.haskell.org git at git.haskell.org
Sat May 13 20:09:15 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/70191f59dd8990c6b1917954a087f4fad67e9c4f/ghc

>---------------------------------------------------------------

commit 70191f59dd8990c6b1917954a087f4fad67e9c4f
Author: David Feuer <david.feuer at gmail.com>
Date:   Sat May 13 16:09:31 2017 -0400

    Add a test for #11272
    
    Reviewers: austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #11272
    
    Differential Revision: https://phabricator.haskell.org/D3561


>---------------------------------------------------------------

70191f59dd8990c6b1917954a087f4fad67e9c4f
 testsuite/tests/simplCore/should_compile/Makefile   |  7 +++++++
 testsuite/tests/simplCore/should_compile/T11272.hs  |  7 +++++++
 testsuite/tests/simplCore/should_compile/T11272a.hs | 10 ++++++++++
 testsuite/tests/simplCore/should_compile/all.T      |  4 ++++
 4 files changed, 28 insertions(+)

diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index 779e7f2..a01edb2 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -218,3 +218,10 @@ str-rules:
 .PHONY: T13340
 T13340:
 	'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep -c '\+#'
+
+
+# We expect to see all dictionaries specialized away.
+.PHONY: T11272
+T11272:
+	'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T11272a.hs
+	'$(TEST_HC)' $(TEST_HC_OPTS) -c -O -ddump-prep T11272.hs | { ! grep Ord ;}
diff --git a/testsuite/tests/simplCore/should_compile/T11272.hs b/testsuite/tests/simplCore/should_compile/T11272.hs
new file mode 100644
index 0000000..d78ee15
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T11272.hs
@@ -0,0 +1,7 @@
+module T11272 where
+
+import T11272a as A
+import Control.Monad.Trans.State
+
+specialised :: Int -> Int -> ()
+specialised x y = execState (A.overloaded x y) ()
diff --git a/testsuite/tests/simplCore/should_compile/T11272a.hs b/testsuite/tests/simplCore/should_compile/T11272a.hs
new file mode 100644
index 0000000..19c9cd2
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T11272a.hs
@@ -0,0 +1,10 @@
+module T11272a where
+
+import Control.Monad.Trans.State
+import Control.Monad
+
+overloaded :: Ord a => a -> a -> State () ()
+overloaded x y = do
+  () <- get
+  when (x <= y) (overloaded y x)
+{-# INLINABLE overloaded #-}
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 1b45930..1af5cbe 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -260,3 +260,7 @@ test('T13468',
      run_command,
      ['$MAKE -s --no-print-directory T13468'])
 test('T13543', normal, compile, ['-ddump-str-signatures'])
+test('T11272',
+     normal,
+     run_command,
+     ['$MAKE -s --no-print-directory T11272'])



More information about the ghc-commits mailing list