summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Errors
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc/Errors')
-rw-r--r--compiler/GHC/Tc/Errors/Ppr.hs22
-rw-r--r--compiler/GHC/Tc/Errors/Types.hs27
2 files changed, 44 insertions, 5 deletions
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs
index a9b1084914..fe5b9c91c2 100644
--- a/compiler/GHC/Tc/Errors/Ppr.hs
+++ b/compiler/GHC/Tc/Errors/Ppr.hs
@@ -1726,9 +1726,7 @@ instance Diagnostic TcRnMessage where
nest 4 (text "in the section:" <+> quotes (ppr section))]
TcRnUnexpectedPatSigType ty
- -> mkSimpleDecorated $
- hang (text "Illegal type signature:" <+> quotes (ppr ty))
- 2 (text "Type signatures are only allowed in patterns with ScopedTypeVariables")
+ -> mkSimpleDecorated $ text "Illegal type signature:" <+> quotes (ppr ty)
TcRnIllegalKindSignature ty
-> mkSimpleDecorated $ text "Illegal kind signature:" <+> quotes (ppr ty)
@@ -1882,6 +1880,14 @@ instance Diagnostic TcRnMessage where
TcRnNonCanonicalDefinition reason inst_ty
-> mkSimpleDecorated $
pprNonCanonicalDefinition inst_ty reason
+ TcRnImplicitForAll fvars -> mkSimpleDecorated $
+ text "Unbound type variable" <> plural fvars <> text ":"
+ <+> pprQuotedList fvars
+
+ TcRnPatternSignatureBinds fvars -> mkSimpleDecorated $
+ sep [text "Type variable binding" <> plural fvars
+ , text "in pattern signature:" <+> pprQuotedList fvars
+ ]
TcRnUnexpectedDeclarationSplice {}
-> mkSimpleDecorated $
text "Declaration splices are not permitted" <+>
@@ -2542,6 +2548,10 @@ instance Diagnostic TcRnMessage where
-> WarningWithFlag Opt_WarnNonCanonicalMonadInstances
TcRnUnexpectedDeclarationSplice {}
-> ErrorWithoutFlag
+ TcRnImplicitForAll{}
+ -> ErrorWithoutFlag
+ TcRnPatternSignatureBinds{}
+ -> WarningWithFlag Opt_WarnPatternSignatureBinds
TcRnImplicitImportOfPrelude {}
-> WarningWithFlag Opt_WarnImplicitPrelude
TcRnMissingMain {}
@@ -3151,7 +3161,7 @@ instance Diagnostic TcRnMessage where
TcRnSectionPrecedenceError{}
-> noHints
TcRnUnexpectedPatSigType{}
- -> [suggestExtension LangExt.ScopedTypeVariables]
+ -> [suggestExtension LangExt.PatternSignatures]
TcRnIllegalKindSignature{}
-> [suggestExtension LangExt.KindSignatures]
TcRnUnusedQuantifiedTypeVar{}
@@ -3221,6 +3231,10 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnNonCanonicalDefinition reason _
-> suggestNonCanonicalDefinition reason
+ TcRnImplicitForAll{}
+ -> [suggestExtension LangExt.ImplicitForAll]
+ TcRnPatternSignatureBinds{}
+ -> noHints
TcRnUnexpectedDeclarationSplice {}
-> noHints
TcRnImplicitImportOfPrelude {}
diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs
index 41fa0515ee..33e7bc9c53 100644
--- a/compiler/GHC/Tc/Errors/Types.hs
+++ b/compiler/GHC/Tc/Errors/Types.hs
@@ -2332,7 +2332,7 @@ data TcRnMessage where
-> TcRnMessage
{-| TcRnUnexpectedPatSigType is an error occurring when there is
- a type signature in a pattern without -XScopedTypeVariables extension
+ a type signature in a pattern without -XPatternSignatures extension
Examples:
f (a :: Bool) = ...
@@ -4180,6 +4180,31 @@ data TcRnMessage where
-}
TcRnMissingRoleAnnotation :: Name -> [Role] -> TcRnMessage
+ {-| TcRnImplicitForAll is an error thrown when a user uses
+ type variables not bound by a forall without
+ enabling the ImplicitForAll extension.
+
+ Example(s):
+
+ id :: a -> a
+ id x = x
+
+ Test case: rename/should_fail/RnNoImplicitForAll
+ -}
+ TcRnImplicitForAll :: [LocatedN RdrName] -> TcRnMessage
+
+ {-| TcRnPatternSignatureBinds is a warning thrown when a user binds
+ type variables in a pattern signature. This is only performed with
+ -Wpattern-signature-binds
+
+ Example(s):
+
+ id (x :: b) = x
+
+ Test case: rename/should_fail/WPatternSigBinds
+ -}
+ TcRnPatternSignatureBinds :: [LocatedN RdrName] -> TcRnMessage
+
deriving Generic
-- | Things forbidden in @type data@ declarations.