From f861fc6ad8e5504a4fecfc9bb0945fe2d313687c Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Thu, 30 Oct 2014 11:39:39 +0000 Subject: Test Trac #9708 --- 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(+) create mode 100644 testsuite/tests/typecheck/should_compile/T9708.hs create mode 100644 testsuite/tests/typecheck/should_compile/T9708.stderr (limited to 'testsuite/tests') 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, ['']) -- cgit v1.2.1