From 9bb2edfb4cefc39c949581e5f85a3b4430730f6d Mon Sep 17 00:00:00 2001 From: Torsten Schmits Date: Tue, 19 Jul 2022 16:57:53 +0200 Subject: add more tests --- testsuite/tests/implicitforall/all.T | 2 ++ testsuite/tests/implicitforall/no-ifa-data-fail.hs | 8 +++++++- testsuite/tests/implicitforall/no-ifa-data-fail.stderr | 6 ++++++ testsuite/tests/implicitforall/no-ifa-data.hs | 17 +++++++++++++++++ testsuite/tests/implicitforall/no-ifa-fun.hs | 7 +++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 testsuite/tests/implicitforall/no-ifa-data.hs create mode 100644 testsuite/tests/implicitforall/no-ifa-fun.hs diff --git a/testsuite/tests/implicitforall/all.T b/testsuite/tests/implicitforall/all.T index 1f9ebd4a43..89905b01fb 100644 --- a/testsuite/tests/implicitforall/all.T +++ b/testsuite/tests/implicitforall/all.T @@ -1,5 +1,7 @@ test('ifa-fun', normal, compile, ['']) test('ifa-fun-fail', normal, compile_fail, ['']) test('ifa-data', normal, compile, ['']) +test('no-ifa-fun', normal, compile, ['']) test('no-ifa-fun-fail', normal, compile_fail, ['']) +test('no-ifa-data', normal, compile, ['']) test('no-ifa-data-fail', normal, compile_fail, ['']) diff --git a/testsuite/tests/implicitforall/no-ifa-data-fail.hs b/testsuite/tests/implicitforall/no-ifa-data-fail.hs index 430a666325..996c72d636 100644 --- a/testsuite/tests/implicitforall/no-ifa-data-fail.hs +++ b/testsuite/tests/implicitforall/no-ifa-data-fail.hs @@ -1,4 +1,4 @@ -{-# language NoImplicitForAll #-} +{-# language NoImplicitForAll, TypeFamilies #-} module ShouldFail where @@ -7,3 +7,9 @@ import Data.Kind (Type) data Imp1 a :: b -> Type data Imp2 a :: forall b . b -> c -> Type + +type family F a :: b + +data family DF a :: a + +data instance DF (Maybe a) :: Maybe a diff --git a/testsuite/tests/implicitforall/no-ifa-data-fail.stderr b/testsuite/tests/implicitforall/no-ifa-data-fail.stderr index 8878b33593..ebb3210a71 100644 --- a/testsuite/tests/implicitforall/no-ifa-data-fail.stderr +++ b/testsuite/tests/implicitforall/no-ifa-data-fail.stderr @@ -1,3 +1,9 @@ no-ifa-data-fail.hs:7:16: Not in scope: type variable ‘b’ no-ifa-data-fail.hs:9:32: Not in scope: type variable ‘c’ + +no-ifa-data-fail.hs:11:20: Not in scope: type variable ‘b’ + +no-ifa-data-fail.hs:15:25: Not in scope: type variable ‘a’ + +no-ifa-data-fail.hs:15:37: Not in scope: type variable ‘a’ diff --git a/testsuite/tests/implicitforall/no-ifa-data.hs b/testsuite/tests/implicitforall/no-ifa-data.hs new file mode 100644 index 0000000000..f65bdce4ba --- /dev/null +++ b/testsuite/tests/implicitforall/no-ifa-data.hs @@ -0,0 +1,17 @@ +{-# language NoImplicitForAll, TypeFamilies #-} + +module ShouldCompile where + +import Data.Kind (Type) + +data family DF a :: a + +type D :: forall k . k -> Type +data D a + +data DK (a :: k) + +type F2 :: forall k . Type -> k -> Type +type family F2 a + +type instance F2 Int = D diff --git a/testsuite/tests/implicitforall/no-ifa-fun.hs b/testsuite/tests/implicitforall/no-ifa-fun.hs new file mode 100644 index 0000000000..676e4aa255 --- /dev/null +++ b/testsuite/tests/implicitforall/no-ifa-fun.hs @@ -0,0 +1,7 @@ +{-# language NoImplicitForAll #-} + +module ShouldCompile where + +h :: forall a . Int -> a -> a +h (i :: b) = + undefined -- cgit v1.2.1