[commit: ghc] master: Test Trac #12845 (83a952d)

git at git.haskell.org git at git.haskell.org
Fri Nov 25 17:47:20 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/83a952d14012ff4706a366a3155712f8caa69ead/ghc

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

commit 83a952d14012ff4706a366a3155712f8caa69ead
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Nov 24 12:15:34 2016 +0000

    Test Trac #12845


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

83a952d14012ff4706a366a3155712f8caa69ead
 .../tests/partial-sigs/should_compile/T12845.hs    | 23 ++++++++++++++++++++++
 .../partial-sigs/should_compile/T12845.stderr      |  7 +++++++
 testsuite/tests/partial-sigs/should_compile/all.T  |  1 +
 3 files changed, 31 insertions(+)

diff --git a/testsuite/tests/partial-sigs/should_compile/T12845.hs b/testsuite/tests/partial-sigs/should_compile/T12845.hs
new file mode 100644
index 0000000..d9b8a99
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/T12845.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE DataKinds             #-}
+{-# LANGUAGE PartialTypeSignatures #-}
+{-# LANGUAGE ScopedTypeVariables   #-}
+{-# LANGUAGE TypeFamilies          #-}
+{-# LANGUAGE TypeOperators         #-}
+
+module T12845 where
+
+import Data.Proxy
+
+data Foo (m :: Bool)
+
+type family Head (xs :: [(Bool, Bool)]) where Head (x ': xs) = x
+
+type family Bar (x :: Bool) (y :: Bool) :: Bool
+
+-- to trigger the bug, r and r' cannot *both* appear on the RHS
+broken :: forall r r' rngs . ('(r,r') ~ Head rngs, Bar r r' ~ 'True, _)
+  => Foo r -> Proxy rngs -> ()
+broken x _ = let y = requireBar x :: Foo r' in ()
+
+requireBar :: (Bar m m' ~ 'True) => Foo m -> Foo m'
+requireBar = undefined
diff --git a/testsuite/tests/partial-sigs/should_compile/T12845.stderr b/testsuite/tests/partial-sigs/should_compile/T12845.stderr
new file mode 100644
index 0000000..0d19b1a
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/T12845.stderr
@@ -0,0 +1,7 @@
+
+T12845.hs:18:70: warning: [-Wpartial-type-signatures (in -Wdefault)]
+    • Found type wildcard ‘_’ standing for ‘() :: Constraint’
+    • In the type signature:
+        broken :: forall r r' rngs.
+                  ('(r, r') ~ Head rngs, Bar r r' ~ True, _) =>
+                  Foo r -> Proxy rngs -> ()
diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T
index d2c6836..b320851 100644
--- a/testsuite/tests/partial-sigs/should_compile/all.T
+++ b/testsuite/tests/partial-sigs/should_compile/all.T
@@ -67,3 +67,4 @@ test('T11339a', normal, compile, [''])
 test('T11670', normal, compile, [''])
 test('T12156', normal, compile_fail, ['-fdefer-typed-holes'])
 test('T12531', normal, compile, ['-fdefer-typed-holes'])
+test('T12845', normal, compile, [''])



More information about the ghc-commits mailing list