diff options
Diffstat (limited to 'testsuite/tests/rename')
6 files changed, 105 insertions, 8 deletions
diff --git a/testsuite/tests/rename/should_fail/RnNoImplicitForAll.hs b/testsuite/tests/rename/should_fail/RnNoImplicitForAll.hs new file mode 100644 index 0000000000..03147242d8 --- /dev/null +++ b/testsuite/tests/rename/should_fail/RnNoImplicitForAll.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE NoImplicitForAll, GADTs, DeriveAnyClass #-} + +module RnNoImplicitForAll where + +import GHC.Types + +f :: a -> a +f = undefined + +type T :: k -> Type +data T k + +data G a where + MkG :: a -> Maybe b -> G (Either Int b) + +rightTrue = Right True :: Either a Bool + +munit :: forall m a . Monad m => m a +munit = pure undefined +{-# SPECIALISE munit :: IO a #-} + +class C a b + +data TD deriving (C a) + +instance Show a => Show (Maybe a) + +type family F a + +type instance F (Maybe a) = Int + +{-# RULES "name" forall (x :: Maybe a). foo x = 5 #-} + +foo x = 5 + +id (a :: t) = t diff --git a/testsuite/tests/rename/should_fail/RnNoImplicitForAll.stderr b/testsuite/tests/rename/should_fail/RnNoImplicitForAll.stderr new file mode 100644 index 0000000000..ff3918ded3 --- /dev/null +++ b/testsuite/tests/rename/should_fail/RnNoImplicitForAll.stderr @@ -0,0 +1,40 @@ + +RnNoImplicitForAll.hs:7:1: error: [GHC-78543] + Unbound type variable: ‘a’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:10:11: error: [GHC-78543] + Unbound type variable: ‘k’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:14:3: error: [GHC-78543] + Unbound type variables: ‘a’, ‘b’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:16:13: error: [GHC-78543] + Unbound type variable: ‘a’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:20:25: error: [GHC-78543] + Unbound type variable: ‘a’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:24:19: error: [GHC-78543] + Unbound type variable: ‘a’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:26:10: error: [GHC-78543] + Unbound type variable: ‘a’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:30:1: error: [GHC-78543] + Unbound type variable: ‘a’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:32:11: error: [GHC-78543] + Unbound type variable: ‘a’ + Suggested fix: Perhaps you intended to use ImplicitForAll + +RnNoImplicitForAll.hs:36:5: error: [GHC-78543] + Unbound type variable: ‘t’ + Suggested fix: Perhaps you intended to use ImplicitForAll diff --git a/testsuite/tests/rename/should_fail/T11663.stderr b/testsuite/tests/rename/should_fail/T11663.stderr index 4602d1992a..ae0e512dbe 100644 --- a/testsuite/tests/rename/should_fail/T11663.stderr +++ b/testsuite/tests/rename/should_fail/T11663.stderr @@ -1,20 +1,16 @@ T11663.hs:6:12: error: [GHC-74097] Illegal type signature: ‘Int’ - Type signatures are only allowed in patterns with ScopedTypeVariables - Suggested fix: Perhaps you intended to use ScopedTypeVariables + Suggested fix: Perhaps you intended to use PatternSignatures T11663.hs:7:9: error: [GHC-74097] Illegal type signature: ‘Int’ - Type signatures are only allowed in patterns with ScopedTypeVariables - Suggested fix: Perhaps you intended to use ScopedTypeVariables + Suggested fix: Perhaps you intended to use PatternSignatures T11663.hs:8:22: error: [GHC-74097] Illegal type signature: ‘Int’ - Type signatures are only allowed in patterns with ScopedTypeVariables - Suggested fix: Perhaps you intended to use ScopedTypeVariables + Suggested fix: Perhaps you intended to use PatternSignatures T11663.hs:9:32: error: [GHC-74097] Illegal type signature: ‘Int’ - Type signatures are only allowed in patterns with ScopedTypeVariables - Suggested fix: Perhaps you intended to use ScopedTypeVariables + Suggested fix: Perhaps you intended to use PatternSignatures diff --git a/testsuite/tests/rename/should_fail/WPatternSigBinds.hs b/testsuite/tests/rename/should_fail/WPatternSigBinds.hs new file mode 100644 index 0000000000..b3bdd68675 --- /dev/null +++ b/testsuite/tests/rename/should_fail/WPatternSigBinds.hs @@ -0,0 +1,8 @@ +{-# OPTIONS_GHC -Wpattern-signature-binds -Werror #-} +module WPatternSigBinds where + +f (x :: a) = x + +g (x :: a) (y :: b) = x + +h (x :: a) (y :: b c d) = x diff --git a/testsuite/tests/rename/should_fail/WPatternSigBinds.stderr b/testsuite/tests/rename/should_fail/WPatternSigBinds.stderr new file mode 100644 index 0000000000..f859316889 --- /dev/null +++ b/testsuite/tests/rename/should_fail/WPatternSigBinds.stderr @@ -0,0 +1,15 @@ + +WPatternSigBinds.hs:4:4: error: [GHC-65467] [-Wpattern-signature-binds, Werror=pattern-signature-binds] + Type variable binding in pattern signature: ‘a’ + +WPatternSigBinds.hs:6:4: error: [GHC-65467] [-Wpattern-signature-binds, Werror=pattern-signature-binds] + Type variable binding in pattern signature: ‘a’ + +WPatternSigBinds.hs:6:13: error: [GHC-65467] [-Wpattern-signature-binds, Werror=pattern-signature-binds] + Type variable binding in pattern signature: ‘b’ + +WPatternSigBinds.hs:8:4: error: [GHC-65467] [-Wpattern-signature-binds, Werror=pattern-signature-binds] + Type variable binding in pattern signature: ‘a’ + +WPatternSigBinds.hs:8:13: error: [GHC-65467] [-Wpattern-signature-binds, Werror=pattern-signature-binds] + Type variable bindings in pattern signature: ‘b’, ‘c’, ‘d’ diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index 883476aac5..b2cc4cd56c 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -198,3 +198,5 @@ test('RnUnexpectedStandaloneDeriving', normal, compile_fail, ['']) test('RnStupidThetaInGadt', normal, compile_fail, ['']) test('PackageImportsDisabled', normal, compile_fail, ['']) test('ImportLookupIllegal', normal, compile_fail, ['']) +test('RnNoImplicitForAll', normal, compile_fail, ['']) +test('WPatternSigBinds', normal, compile_fail, ['']) |