[commit: ghc] master: Test Trac #9708 (f861fc6)

git at git.haskell.org git at git.haskell.org
Tue Nov 4 10:38:43 UTC 2014


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

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

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

commit f861fc6ad8e5504a4fecfc9bb0945fe2d313687c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Oct 30 11:39:39 2014 +0000

    Test Trac #9708


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

f861fc6ad8e5504a4fecfc9bb0945fe2d313687c
 testsuite/tests/typecheck/should_compile/T9708.hs     | 10 ++++++++++
 testsuite/tests/typecheck/should_compile/T9708.stderr | 17 +++++++++++++++++
 testsuite/tests/typecheck/should_compile/all.T        |  1 +
 3 files changed, 28 insertions(+)

diff --git a/testsuite/tests/typecheck/should_compile/T9708.hs b/testsuite/tests/typecheck/should_compile/T9708.hs
new file mode 100644
index 0000000..fa6deb2
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T9708.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-}
+module TcTypeNatSimple where
+
+import GHC.TypeLits
+import Data.Proxy
+
+type family SomeFun (n :: Nat)
+
+ti7 :: (x <= y, y <= x) => Proxy (SomeFun x) -> Proxy y -> ()
+ti7 _ _ = ()
diff --git a/testsuite/tests/typecheck/should_compile/T9708.stderr b/testsuite/tests/typecheck/should_compile/T9708.stderr
new file mode 100644
index 0000000..fca5df7
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T9708.stderr
@@ -0,0 +1,17 @@
+
+T9708.hs:9:8:
+    Could not deduce (SomeFun x ~ SomeFun y)
+    from the context (x <= y, y <= x)
+      bound by the type signature for
+                 ti7 :: (x <= y, y <= x) => Proxy (SomeFun x) -> Proxy y -> ()
+      at T9708.hs:9:8-61
+    NB: ‘SomeFun’ is a type function, and may not be injective
+    Expected type: Proxy (SomeFun x) -> Proxy y -> ()
+      Actual type: Proxy (SomeFun y) -> Proxy y -> ()
+    In the ambiguity check for:
+      forall (x :: Nat) (y :: Nat).
+      (x <= y, y <= x) =>
+      Proxy (SomeFun x) -> Proxy y -> ()
+    To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+    In the type signature for ‘ti7’:
+      ti7 :: (x <= y, y <= x) => Proxy (SomeFun x) -> Proxy y -> ()
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 8b8155d..a6cb78a 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -421,3 +421,4 @@ test('MutRec', normal, compile, [''])
 test('T8856', normal, compile, [''])
 test('T9117', normal, compile, [''])
 test('T9117_2', expect_broken('9117'), compile, [''])
+test('T9708', normal, compile_fail, [''])



More information about the ghc-commits mailing list