summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2017-05-13 16:09:31 -0400
committerDavid Feuer <David.Feuer@gmail.com>2017-05-13 16:09:32 -0400
commit70191f59dd8990c6b1917954a087f4fad67e9c4f (patch)
tree475b7c4f0ea24577053ecabb68ccf6864fb3469c
parent3032ae81dd14c2eaefa9ecd8880dafa9bda104d9 (diff)
downloadhaskell-70191f59dd8990c6b1917954a087f4fad67e9c4f.tar.gz
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
-rw-r--r--testsuite/tests/simplCore/should_compile/Makefile7
-rw-r--r--testsuite/tests/simplCore/should_compile/T11272.hs7
-rw-r--r--testsuite/tests/simplCore/should_compile/T11272a.hs10
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T4
4 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index 779e7f2ef6..a01edb220d 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 0000000000..d78ee152f6
--- /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 0000000000..19c9cd2feb
--- /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 1b45930130..1af5cbed25 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'])