summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-10-30 11:39:39 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-10-31 09:08:53 +0000
commit8075e4327df83b6a68100c07937f5e01a4801ecd (patch)
tree4f8630a13ab11848e1ba13fd91858bdae15beec0
parentd60edce187223594acc4139fefdef0ed886bdf35 (diff)
downloadhaskell-8075e4327df83b6a68100c07937f5e01a4801ecd.tar.gz
Test Trac #9708
-rw-r--r--testsuite/tests/typecheck/should_compile/T9708.hs10
-rw-r--r--testsuite/tests/typecheck/should_compile/T9708.stderr17
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
3 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T9708.hs b/testsuite/tests/typecheck/should_compile/T9708.hs
new file mode 100644
index 0000000000..fa6deb2cdf
--- /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 0000000000..fca5df7bc8
--- /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 8b8155d186..a6cb78a3cd 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, [''])