summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-05-17 13:44:23 -0400
committerBen Gamari <ben@smart-cactus.org>2023-05-17 16:30:54 -0400
commit0190e9fe6f6f5989fbd016881388c20a7fde3bcb (patch)
tree34701dd8040defeb0907558c55843f066f0ba45d /testsuite
parent2972fd66f91cb51426a1df86b8166a067015e231 (diff)
downloadhaskell-wip/sand-witch/modern-STV-extension-shuffling.tar.gz
Where introduced 4 new extensions: - PatternSignatures - ExtendedForAllScope - MethodTypeVariables - ImplicitForAll Tasks of ScopedTypeVariables extension were distributed between PatternSignatures, ExtendedForAllScope and MethodTypeVariables according to the proposal. Now ScopedTypeVaribles only implies these three exntesions. Extension ImplicitForAll saves current behavior. NoImplicitForAll disables implicit bounding of type variables in many contexts. Was introduced one new warning option: -Wpattern-signature-binds It warns when pattern signature binds into scope new type variable. For example: f (a :: t) = ...
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/driver/T4437.hs5
-rw-r--r--testsuite/tests/rename/should_fail/RnNoImplicitForAll.hs36
-rw-r--r--testsuite/tests/rename/should_fail/RnNoImplicitForAll.stderr40
-rw-r--r--testsuite/tests/rename/should_fail/T11663.stderr12
-rw-r--r--testsuite/tests/rename/should_fail/WPatternSigBinds.hs8
-rw-r--r--testsuite/tests/rename/should_fail/WPatternSigBinds.stderr15
-rw-r--r--testsuite/tests/rename/should_fail/all.T2
-rw-r--r--testsuite/tests/showIface/DocsInHiFile1.stdout4
-rw-r--r--testsuite/tests/showIface/DocsInHiFileTH.stdout4
-rw-r--r--testsuite/tests/showIface/HaddockIssue849.stdout4
-rw-r--r--testsuite/tests/showIface/HaddockOpts.stdout4
-rw-r--r--testsuite/tests/showIface/LanguageExts.stdout1
-rw-r--r--testsuite/tests/showIface/MagicHashInHaddocks.stdout4
-rw-r--r--testsuite/tests/showIface/NoExportList.stdout4
-rw-r--r--testsuite/tests/showIface/PragmaDocs.stdout4
-rw-r--r--testsuite/tests/showIface/ReExports.stdout4
-rw-r--r--testsuite/tests/typecheck/should_fail/PatSynExistential.stderr7
17 files changed, 146 insertions, 12 deletions
diff --git a/testsuite/tests/driver/T4437.hs b/testsuite/tests/driver/T4437.hs
index 142c348fca..5c81cf0525 100644
--- a/testsuite/tests/driver/T4437.hs
+++ b/testsuite/tests/driver/T4437.hs
@@ -38,7 +38,10 @@ check title expected got
expectedGhcOnlyExtensions :: [String]
expectedGhcOnlyExtensions =
[ "TypeAbstractions",
- "ExtendedLiterals"
+ "ExtendedLiterals",
+ "MethodTypeVariables",
+ "ExtendedForAllScope",
+ "ImplicitForAll"
]
expectedCabalOnlyExtensions :: [String]
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, [''])
diff --git a/testsuite/tests/showIface/DocsInHiFile1.stdout b/testsuite/tests/showIface/DocsInHiFile1.stdout
index b74854d941..d46dfa240b 100644
--- a/testsuite/tests/showIface/DocsInHiFile1.stdout
+++ b/testsuite/tests/showIface/DocsInHiFile1.stdout
@@ -144,5 +144,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/DocsInHiFileTH.stdout b/testsuite/tests/showIface/DocsInHiFileTH.stdout
index 57ec74c37d..1179d04ae8 100644
--- a/testsuite/tests/showIface/DocsInHiFileTH.stdout
+++ b/testsuite/tests/showIface/DocsInHiFileTH.stdout
@@ -287,5 +287,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/HaddockIssue849.stdout b/testsuite/tests/showIface/HaddockIssue849.stdout
index 3bd32adbcc..a4f7dc5278 100644
--- a/testsuite/tests/showIface/HaddockIssue849.stdout
+++ b/testsuite/tests/showIface/HaddockIssue849.stdout
@@ -67,5 +67,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/HaddockOpts.stdout b/testsuite/tests/showIface/HaddockOpts.stdout
index 8af1142afe..3feab090c5 100644
--- a/testsuite/tests/showIface/HaddockOpts.stdout
+++ b/testsuite/tests/showIface/HaddockOpts.stdout
@@ -59,5 +59,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/LanguageExts.stdout b/testsuite/tests/showIface/LanguageExts.stdout
index 1e0a2a89be..6fafc2a6f7 100644
--- a/testsuite/tests/showIface/LanguageExts.stdout
+++ b/testsuite/tests/showIface/LanguageExts.stdout
@@ -22,5 +22,6 @@ docs:
StarIsType
CUSKs
FieldSelectors
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/MagicHashInHaddocks.stdout b/testsuite/tests/showIface/MagicHashInHaddocks.stdout
index 2eb7eee959..d7450bff6b 100644
--- a/testsuite/tests/showIface/MagicHashInHaddocks.stdout
+++ b/testsuite/tests/showIface/MagicHashInHaddocks.stdout
@@ -69,5 +69,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/NoExportList.stdout b/testsuite/tests/showIface/NoExportList.stdout
index 669774d8e4..5d7e7bd6b1 100644
--- a/testsuite/tests/showIface/NoExportList.stdout
+++ b/testsuite/tests/showIface/NoExportList.stdout
@@ -95,5 +95,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/PragmaDocs.stdout b/testsuite/tests/showIface/PragmaDocs.stdout
index b2a9c929c6..0eff820a69 100644
--- a/testsuite/tests/showIface/PragmaDocs.stdout
+++ b/testsuite/tests/showIface/PragmaDocs.stdout
@@ -69,5 +69,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/showIface/ReExports.stdout b/testsuite/tests/showIface/ReExports.stdout
index f0c1ab2c9f..f695a8da2d 100644
--- a/testsuite/tests/showIface/ReExports.stdout
+++ b/testsuite/tests/showIface/ReExports.stdout
@@ -66,5 +66,9 @@ docs:
StandaloneKindSignatures
FieldSelectors
TypeAbstractions
+ PatternSignatures
+ ExtendedForAllScope
+ MethodTypeVariables
+ ImplicitForAll
extensible fields:
diff --git a/testsuite/tests/typecheck/should_fail/PatSynExistential.stderr b/testsuite/tests/typecheck/should_fail/PatSynExistential.stderr
index 326974dc55..fe75d0bc24 100644
--- a/testsuite/tests/typecheck/should_fail/PatSynExistential.stderr
+++ b/testsuite/tests/typecheck/should_fail/PatSynExistential.stderr
@@ -1,4 +1,5 @@
-PatSynExistential.hs:6:1: [GHC-33973]
- The result type of the signature for ‘P’, namely ‘x -> Maybe x’
+
+PatSynExistential.hs:6:1: error: [GHC-33973]
+ • The result type of the signature for ‘P’, namely ‘x -> Maybe x’
mentions existential type variable ‘x’
- In the declaration for pattern synonym ‘P’
+ • In the declaration for pattern synonym ‘P’