diff options
40 files changed, 284 insertions, 159 deletions
diff --git a/compiler/GHC/Parser/Errors/Basic.hs b/compiler/GHC/Parser/Errors/Basic.hs new file mode 100644 index 0000000000..6cec1da8d6 --- /dev/null +++ b/compiler/GHC/Parser/Errors/Basic.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE LambdaCase #-} +module GHC.Parser.Errors.Basic where + +import GHC.Utils.Outputable ( SDoc, text ) + +-- | The operator symbol in the 'PsOperatorWhitespaceExtConflictMessage' diagnostic. +data OperatorWhitespaceSymbol + = OperatorWhitespaceSymbol_PrefixPercent + | OperatorWhitespaceSymbol_PrefixDollar + | OperatorWhitespaceSymbol_PrefixDollarDollar + +pprOperatorWhitespaceSymbol :: OperatorWhitespaceSymbol -> SDoc +pprOperatorWhitespaceSymbol = \case + OperatorWhitespaceSymbol_PrefixPercent -> text "%" + OperatorWhitespaceSymbol_PrefixDollar -> text "$" + OperatorWhitespaceSymbol_PrefixDollarDollar -> text "$$" + +-- | The operator occurrence type in the 'PsOperatorWhitespaceMessage' diagnostic. +data OperatorWhitespaceOccurrence + = OperatorWhitespaceOccurrence_Prefix + | OperatorWhitespaceOccurrence_Suffix + | OperatorWhitespaceOccurrence_TightInfix diff --git a/compiler/GHC/Parser/Errors/Ppr.hs b/compiler/GHC/Parser/Errors/Ppr.hs index b349f310e2..048605a225 100644 --- a/compiler/GHC/Parser/Errors/Ppr.hs +++ b/compiler/GHC/Parser/Errors/Ppr.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE MultiWayIf #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE FlexibleContexts #-} @@ -9,6 +10,7 @@ module GHC.Parser.Errors.Ppr where import GHC.Prelude import GHC.Driver.Flags +import GHC.Parser.Errors.Basic import GHC.Parser.Errors.Types import GHC.Parser.Types import GHC.Types.Basic @@ -57,23 +59,20 @@ instance Diagnostic PsMessage where TransLayout_Pipe -> "`|' at the same depth as implicit layout block" ) PsWarnOperatorWhitespaceExtConflict sym - -> let mk_prefix_msg operator_symbol extension_name syntax_meaning = - text "The prefix use of a" <+> quotes (text operator_symbol) + -> let mk_prefix_msg extension_name syntax_meaning = + text "The prefix use of a" <+> quotes (pprOperatorWhitespaceSymbol sym) <+> text "would denote" <+> text syntax_meaning $$ nest 2 (text "were the" <+> text extension_name <+> text "extension enabled.") - $$ text "Suggested fix: add whitespace after the" - <+> quotes (text operator_symbol) <> char '.' in mkSimpleDecorated $ case sym of - OperatorWhitespaceSymbol_PrefixPercent -> mk_prefix_msg "%" "LinearTypes" "a multiplicity annotation" - OperatorWhitespaceSymbol_PrefixDollar -> mk_prefix_msg "$" "TemplateHaskell" "an untyped splice" - OperatorWhitespaceSymbol_PrefixDollarDollar -> mk_prefix_msg "$$" "TemplateHaskell" "a typed splice" + OperatorWhitespaceSymbol_PrefixPercent -> mk_prefix_msg "LinearTypes" "a multiplicity annotation" + OperatorWhitespaceSymbol_PrefixDollar -> mk_prefix_msg "TemplateHaskell" "an untyped splice" + OperatorWhitespaceSymbol_PrefixDollarDollar -> mk_prefix_msg "TemplateHaskell" "a typed splice" PsWarnOperatorWhitespace sym occ_type -> let mk_msg occ_type_str = text "The" <+> text occ_type_str <+> text "use of a" <+> quotes (ftext sym) <+> text "might be repurposed as special syntax" $$ nest 2 (text "by a future language extension.") - $$ text "Suggested fix: add whitespace around it." in mkSimpleDecorated $ case occ_type of OperatorWhitespaceOccurrence_Prefix -> mk_msg "prefix" @@ -83,9 +82,6 @@ instance Diagnostic PsMessage where -> mkSimpleDecorated $ text "Found binding occurrence of" <+> quotes (text "*") <+> text "yet StarIsType is enabled." - $$ text "NB. To use (or export) this operator in" - <+> text "modules with StarIsType," - $$ text " including the definition module, you must qualify it." PsWarnStarIsType -> mkSimpleDecorated $ text "Using" <+> quotes (text "*") @@ -93,17 +89,12 @@ instance Diagnostic PsMessage where <+> quotes (text "Data.Kind.Type") $$ text "relies on the StarIsType extension, which will become" $$ text "deprecated in the future." - $$ text "Suggested fix: use" <+> quotes (text "Type") - <+> text "from" <+> quotes (text "Data.Kind") <+> text "instead." PsWarnUnrecognisedPragma -> mkSimpleDecorated $ text "Unrecognised pragma" PsWarnImportPreQualified -> mkSimpleDecorated $ text "Found" <+> quotes (text "qualified") <+> text "in prepositive position" - $$ text "Suggested fix: place " <+> quotes (text "qualified") - <+> text "after the module name instead." - $$ text "To allow this, enable language extension 'ImportQualifiedPost'" PsErrLexer err kind -> mkSimpleDecorated $ hcat @@ -161,38 +152,34 @@ instance Diagnostic PsMessage where -> mkSimpleDecorated $ text "Expected a hyphen" PsErrSpaceInSCC -> mkSimpleDecorated $ text "Spaces are not allowed in SCCs" - PsErrEmptyDoubleQuotes th_on - -> mkSimpleDecorated $ if th_on then vcat (msg ++ th_msg) else vcat msg + PsErrEmptyDoubleQuotes _th_on + -> mkSimpleDecorated $ vcat msg where msg = [ text "Parser error on `''`" , text "Character literals may not be empty" ] - th_msg = [ text "Or perhaps you intended to use quotation syntax of TemplateHaskell," - , text "but the type variable or constructor is missing" - ] - PsErrLambdaCase - -> mkSimpleDecorated $ text "Illegal lambda-case (use LambdaCase)" + -> mkSimpleDecorated $ text "Illegal lambda-case" PsErrEmptyLambda -> mkSimpleDecorated $ text "A lambda requires at least one parameter" PsErrLinearFunction - -> mkSimpleDecorated $ text "Enable LinearTypes to allow linear functions" + -> mkSimpleDecorated $ text "Illegal use of linear functions" PsErrOverloadedRecordUpdateNotEnabled - -> mkSimpleDecorated $ text "OverloadedRecordUpdate needs to be enabled" + -> mkSimpleDecorated $ text "Illegal overloaded record update" PsErrMultiWayIf - -> mkSimpleDecorated $ text "Multi-way if-expressions need MultiWayIf turned on" + -> mkSimpleDecorated $ text "Illegal multi-way if-expression" PsErrNumUnderscores reason -> mkSimpleDecorated $ text $ case reason of - NumUnderscore_Integral -> "Use NumericUnderscores to allow underscores in integer literals" - NumUnderscore_Float -> "Use NumericUnderscores to allow underscores in floating literals" + NumUnderscore_Integral -> "Illegal underscores in integer literals" + NumUnderscore_Float -> "Illegal underscores in floating literals" PsErrIllegalBangPattern e - -> mkSimpleDecorated $ text "Illegal bang-pattern (use BangPatterns):" $$ ppr e + -> mkSimpleDecorated $ text "Illegal bang-pattern" $$ ppr e PsErrOverloadedRecordDotInvalid -> mkSimpleDecorated $ text "Use of OverloadedRecordDot '.' not valid ('.' isn't allowed when constructing records or in record patterns)" PsErrIllegalPatSynExport - -> mkSimpleDecorated $ text "Illegal export form (use PatternSynonyms to enable)" + -> mkSimpleDecorated $ text "Illegal export form" PsErrOverloadedRecordUpdateNoQualifiedFields -> mkSimpleDecorated $ text "Fields cannot be qualified when OverloadedRecordUpdate is enabled" PsErrExplicitForall is_unicode @@ -206,10 +193,8 @@ instance Diagnostic PsMessage where forallSym True = text "∀" forallSym False = text "forall" PsErrIllegalQualifiedDo qdoDoc - -> mkSimpleDecorated $ vcat - [ text "Illegal qualified" <+> quotes qdoDoc <+> text "block" - , text "Perhaps you intended to use QualifiedDo" - ] + -> mkSimpleDecorated $ + text "Illegal qualified" <+> quotes qdoDoc <+> text "block" PsErrQualifiedDoInCmd m -> mkSimpleDecorated $ hang (text "Parse error in command:") 2 $ @@ -245,7 +230,7 @@ instance Diagnostic PsMessage where ] PsErrIllegalExplicitNamespace -> mkSimpleDecorated $ - text "Illegal keyword 'type' (use ExplicitNamespaces to enable)" + text "Illegal keyword 'type'" PsErrUnallowedPragma prag -> mkSimpleDecorated $ @@ -255,7 +240,6 @@ instance Diagnostic PsMessage where -> mkSimpleDecorated $ text "Found" <+> quotes (text "qualified") <+> text "in postpositive position. " - $$ text "To allow this, enable language extension 'ImportQualifiedPost'" PsErrImportQualifiedTwice -> mkSimpleDecorated $ text "Multiple occurrences of 'qualified'" PsErrIllegalImportBundleForm @@ -382,7 +366,7 @@ instance Diagnostic PsMessage where ] PsErrIllegalDataTypeContext c -> mkSimpleDecorated $ - text "Illegal datatype context (use DatatypeContexts):" + text "Illegal datatype context:" <+> pprLHsContext (Just c) PsErrPrimStringInvalidChar -> mkSimpleDecorated $ text "primitive string literal must contain only characters <= \'\\xFF\'" @@ -395,7 +379,6 @@ instance Diagnostic PsMessage where -> mkSimpleDecorated $ text "Unexpected semi-colons in conditional:" $$ nest 4 expr - $$ text "Perhaps you meant to use DoAndIfThenElse?" where pprOptSemi True = semi pprOptSemi False = empty @@ -406,7 +389,6 @@ instance Diagnostic PsMessage where -> mkSimpleDecorated $ text "Unexpected semi-colons in conditional:" $$ nest 4 expr - $$ text "Perhaps you meant to use DoAndIfThenElse?" where pprOptSemi True = semi pprOptSemi False = empty @@ -439,7 +421,7 @@ instance Diagnostic PsMessage where -> mkSimpleDecorated $ text "Inferred type variables are not allowed here" PsErrIllegalTraditionalRecordSyntax s -> mkSimpleDecorated $ - text "Illegal record syntax (use TraditionalRecordSyntax):" <+> s + text "Illegal record syntax:" <+> s PsErrParseErrorInCmd s -> mkSimpleDecorated $ hang (text "Parse error in command:") 2 s PsErrInPat s details @@ -463,43 +445,14 @@ instance Diagnostic PsMessage where in mkSimpleDecorated $ msg <+> body PsErrParseRightOpSectionInPat infixOcc s -> mkSimpleDecorated $ parse_error_in_pat <+> pprInfixOcc infixOcc <> ppr s - PsErrIllegalRoleName role nearby + PsErrIllegalRoleName role _nearby -> mkSimpleDecorated $ text "Illegal role name" <+> quotes (ppr role) - $$ case nearby of - [] -> empty - [r] -> text "Perhaps you meant" <+> quotes (ppr r) - -- will this last case ever happen?? - _ -> hang (text "Perhaps you meant one of these:") - 2 (pprWithCommas (quotes . ppr) nearby) PsErrInvalidTypeSignature lhs -> mkSimpleDecorated $ text "Invalid type signature:" <+> ppr lhs <+> text ":: ..." - $$ text hint - where - hint | foreign_RDR `looks_like` lhs - = "Perhaps you meant to use ForeignFunctionInterface?" - | default_RDR `looks_like` lhs - = "Perhaps you meant to use DefaultSignatures?" - | pattern_RDR `looks_like` lhs - = "Perhaps you meant to use PatternSynonyms?" - | otherwise - = "Should be of form <variables> :: <type>" - - -- A common error is to forget the ForeignFunctionInterface flag - -- so check for that, and suggest. cf #3805 - -- Sadly 'foreign import' still barfs 'parse error' because - -- 'import' is a keyword - -- looks_like :: RdrName -> LHsExpr GhcPsErr -> Bool -- AZ - looks_like s (L _ (HsVar _ (L _ v))) = v == s - looks_like s (L _ (HsApp _ lhs _)) = looks_like s lhs - looks_like _ _ = False - - foreign_RDR = mkUnqual varName (fsLit "foreign") - default_RDR = mkUnqual varName (fsLit "default") - pattern_RDR = mkUnqual varName (fsLit "pattern") PsErrUnexpectedTypeInDecl t what tc tparms equals_or_where -> mkSimpleDecorated $ vcat [ text "Unexpected type" <+> quotes (ppr t) @@ -646,14 +599,15 @@ instance Diagnostic PsMessage where PsHeaderMessage m -> psHeaderMessageHints m PsWarnTab{} -> [SuggestUseSpaces] PsWarnTransitionalLayout{} -> noHints - PsWarnOperatorWhitespaceExtConflict{} -> noHints - PsWarnOperatorWhitespace{} -> noHints + PsWarnOperatorWhitespaceExtConflict sym -> [SuggestUseWhitespaceAfter sym] + PsWarnOperatorWhitespace sym occ -> [SuggestUseWhitespaceAround (unpackFS sym) occ] PsWarnHaddockInvalidPos -> noHints PsWarnHaddockIgnoreMulti -> noHints - PsWarnStarBinder -> noHints - PsWarnStarIsType -> noHints + PsWarnStarBinder -> [SuggestQualifyStarOperator] + PsWarnStarIsType -> [SuggestUseTypeFromDataKind] PsWarnUnrecognisedPragma -> noHints - PsWarnImportPreQualified -> noHints + PsWarnImportPreQualified -> [ SuggestQualifiedAfterModuleName + , SuggestExtension LangExt.ImportQualifiedPost] PsErrLexer{} -> noHints PsErrCmmLexer -> noHints PsErrCmmParser{} -> noHints @@ -672,19 +626,20 @@ instance Diagnostic PsMessage where PsErrInvalidInfixHole -> noHints PsErrExpectedHyphen -> noHints PsErrSpaceInSCC -> noHints - PsErrEmptyDoubleQuotes{} -> noHints - PsErrLambdaCase{} -> noHints + PsErrEmptyDoubleQuotes th_on | th_on -> [SuggestThQuotationSyntax] + | otherwise -> noHints + PsErrLambdaCase{} -> [SuggestExtension LangExt.LambdaCase] PsErrEmptyLambda{} -> noHints - PsErrLinearFunction{} -> noHints - PsErrMultiWayIf{} -> noHints - PsErrOverloadedRecordUpdateNotEnabled{} -> noHints - PsErrNumUnderscores{} -> noHints - PsErrIllegalBangPattern{} -> noHints + PsErrLinearFunction{} -> [SuggestExtension LangExt.LinearTypes] + PsErrMultiWayIf{} -> [SuggestExtension LangExt.MultiWayIf] + PsErrOverloadedRecordUpdateNotEnabled{} -> [SuggestExtension LangExt.OverloadedRecordUpdate] + PsErrNumUnderscores{} -> [SuggestExtension LangExt.NumericUnderscores] + PsErrIllegalBangPattern{} -> [SuggestExtension LangExt.BangPatterns] PsErrOverloadedRecordDotInvalid{} -> noHints - PsErrIllegalPatSynExport -> noHints + PsErrIllegalPatSynExport -> [SuggestExtension LangExt.PatternSynonyms] PsErrOverloadedRecordUpdateNoQualifiedFields -> noHints PsErrExplicitForall{} -> noHints - PsErrIllegalQualifiedDo{} -> noHints + PsErrIllegalQualifiedDo{} -> [SuggestExtension LangExt.QualifiedDo] PsErrQualifiedDoInCmd{} -> noHints PsErrRecordSyntaxInPatSynDecl{} -> noHints PsErrEmptyWhereInPatSynDecl{} -> noHints @@ -692,9 +647,9 @@ instance Diagnostic PsMessage where PsErrNoSingleWhereBindInPatSynDecl{} -> noHints PsErrDeclSpliceNotAtTopLevel{} -> noHints PsErrMultipleNamesInStandaloneKindSignature{} -> noHints - PsErrIllegalExplicitNamespace -> noHints + PsErrIllegalExplicitNamespace -> [SuggestExtension LangExt.ExplicitNamespaces] PsErrUnallowedPragma{} -> noHints - PsErrImportPostQualified -> noHints + PsErrImportPostQualified -> [SuggestExtension LangExt.ImportQualifiedPost] PsErrImportQualifiedTwice -> noHints PsErrIllegalImportBundleForm -> noHints PsErrInvalidRuleActivationMarker -> noHints @@ -738,19 +693,19 @@ instance Diagnostic PsMessage where PsErrProcInFunAppExpr{} -> suggestParensAndBlockArgs PsErrMalformedTyOrClDecl{} -> noHints PsErrIllegalWhereInDataDecl -> noHints - PsErrIllegalDataTypeContext{} -> noHints + PsErrIllegalDataTypeContext{} -> [SuggestExtension LangExt.DatatypeContexts] PsErrPrimStringInvalidChar -> noHints PsErrSuffixAT -> noHints PsErrPrecedenceOutOfRange{} -> noHints - PsErrSemiColonsInCondExpr{} -> noHints - PsErrSemiColonsInCondCmd{} -> noHints + PsErrSemiColonsInCondExpr{} -> [SuggestExtension LangExt.DoAndIfThenElse] + PsErrSemiColonsInCondCmd{} -> [SuggestExtension LangExt.DoAndIfThenElse] PsErrAtInPatPos -> noHints PsErrParseErrorOnInput{} -> noHints PsErrMalformedDecl{} -> noHints PsErrUnexpectedTypeAppInDecl{} -> noHints PsErrNotADataCon{} -> noHints PsErrInferredTypeVarNotAllowed -> noHints - PsErrIllegalTraditionalRecordSyntax{} -> noHints + PsErrIllegalTraditionalRecordSyntax{} -> [SuggestExtension LangExt.TraditionalRecordSyntax] PsErrParseErrorInCmd{} -> noHints PsErrInPat _ details -> case details of PEIP_RecPattern args YesPatIsRecursive ctx @@ -763,8 +718,29 @@ instance Diagnostic PsMessage where sug_missingdo (ParseContext _ YesIncompleteDoBlock) = Just SuggestMissingDo sug_missingdo _ = Nothing PsErrParseRightOpSectionInPat{} -> noHints - PsErrIllegalRoleName{} -> noHints - PsErrInvalidTypeSignature{} -> noHints + PsErrIllegalRoleName _ nearby -> [SuggestRoles nearby] + PsErrInvalidTypeSignature lhs -> + if | foreign_RDR `looks_like` lhs + -> [SuggestExtension LangExt.ForeignFunctionInterface] + | default_RDR `looks_like` lhs + -> [SuggestExtension LangExt.DefaultSignatures] + | pattern_RDR `looks_like` lhs + -> [SuggestExtension LangExt.PatternSynonyms] + | otherwise + -> [SuggestTypeSignatureForm] + where + -- A common error is to forget the ForeignFunctionInterface flag + -- so check for that, and suggest. cf #3805 + -- Sadly 'foreign import' still barfs 'parse error' because + -- 'import' is a keyword + -- looks_like :: RdrName -> LHsExpr GhcPsErr -> Bool -- AZ + looks_like s (L _ (HsVar _ (L _ v))) = v == s + looks_like s (L _ (HsApp _ lhs _)) = looks_like s lhs + looks_like _ _ = False + + foreign_RDR = mkUnqual varName (fsLit "foreign") + default_RDR = mkUnqual varName (fsLit "default") + pattern_RDR = mkUnqual varName (fsLit "pattern") PsErrUnexpectedTypeInDecl{} -> noHints PsErrInvalidPackageName{} -> noHints PsErrIllegalGadtRecordMultiplicity{} -> noHints diff --git a/compiler/GHC/Parser/Errors/Types.hs b/compiler/GHC/Parser/Errors/Types.hs index 95b1733c6e..a78685c11a 100644 --- a/compiler/GHC/Parser/Errors/Types.hs +++ b/compiler/GHC/Parser/Errors/Types.hs @@ -10,6 +10,7 @@ import GHC.Core.TyCon (Role) import GHC.Data.FastString import GHC.Hs import GHC.Parser.Types +import GHC.Parser.Errors.Basic import GHC.Types.Error import GHC.Types.Name.Occurrence (OccName) import GHC.Types.Name.Reader @@ -511,18 +512,6 @@ data CmmParserError | CmmUnrecognisedSafety !String -- ^ Unrecognised safety | CmmUnrecognisedHint !String -- ^ Unrecognised hint --- | The operator symbol in the 'PsOperatorWhitespaceExtConflictMessage' diagnostic. -data OperatorWhitespaceSymbol - = OperatorWhitespaceSymbol_PrefixPercent - | OperatorWhitespaceSymbol_PrefixDollar - | OperatorWhitespaceSymbol_PrefixDollarDollar - --- | The operator occurrence type in the 'PsOperatorWhitespaceMessage' diagnostic. -data OperatorWhitespaceOccurrence - = OperatorWhitespaceOccurrence_Prefix - | OperatorWhitespaceOccurrence_Suffix - | OperatorWhitespaceOccurrence_TightInfix - data TransLayoutReason = TransLayout_Where -- ^ "`where' clause at the same depth as implicit layout block" | TransLayout_Pipe -- ^ "`|' at the same depth as implicit layout block") diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x index 6c7a12395a..95fc574cb2 100644 --- a/compiler/GHC/Parser/Lexer.x +++ b/compiler/GHC/Parser/Lexer.x @@ -124,6 +124,7 @@ import GHC.Parser.CharClass import GHC.Parser.Annotation import GHC.Driver.Flags +import GHC.Parser.Errors.Basic import GHC.Parser.Errors.Types import GHC.Parser.Errors.Ppr () } diff --git a/compiler/GHC/Types/Hint.hs b/compiler/GHC/Types/Hint.hs index 883bfa4af4..e1ed317753 100644 --- a/compiler/GHC/Types/Hint.hs +++ b/compiler/GHC/Types/Hint.hs @@ -5,13 +5,16 @@ module GHC.Types.Hint ( InstantiationSuggestion(..) ) where +import GHC.Prelude + import GHC.Utils.Outputable import qualified GHC.LanguageExtensions as LangExt import Data.Typeable import GHC.Unit.Module (ModuleName, Module) import GHC.Hs.Extension (GhcTc) -import GHC.Types.Var (Var) +import GHC.Core.Coercion import GHC.Types.Basic (Activation, RuleName) +import GHC.Parser.Errors.Basic import {-# SOURCE #-} Language.Haskell.Syntax.Expr -- This {-# SOURCE #-} import should be removable once -- 'Language.Haskell.Syntax.Bind' no longer depends on 'GHC.Tc.Types.Evidence'. @@ -83,6 +86,25 @@ data GhcHint Test Case(s): None -} | SuggestUseSpaces + {-| Suggests adding a whitespace after the given symbol. + + Examples: None + Test Case(s): parser/should_compile/T18834a.hs + -} + | SuggestUseWhitespaceAfter !OperatorWhitespaceSymbol + {-| Suggests adding a whitespace around the given operator symbol, + as it might be repurposed as special syntax by a future language extension. + The second parameter is how such operator occurred, if in a prefix, suffix + or tight infix position. + + Triggered by: 'GHC.Parser.Errors.Types.PsWarnOperatorWhitespace'. + + Example: + h a b = a+b -- not OK, no spaces around '+'. + + Test Case(s): parser/should_compile/T18834b.hs + -} + | SuggestUseWhitespaceAround !String !OperatorWhitespaceOccurrence {-| Suggests wrapping an expression in parentheses Examples: None @@ -115,11 +137,63 @@ data GhcHint | SuggestAddInlineOrNoInlinePragma !Var !Activation | SuggestAddPhaseToCompetingRule !RuleName - {-| Suggests increasing the limit for the number of iterations in the simplifier. -} | SuggestIncreaseSimplifierIterations + {-| Suggests to explicitly import 'Type' from the 'Data.Kind' module, because + using "*" to mean 'Data.Kind.Type' relies on the StarIsType extension, which + will become deprecated in the future. + + Triggered by: 'GHC.Parser.Errors.Types.PsWarnStarIsType' + Example: None + Test case(s): wcompat-warnings/WCompatWarningsOn.hs + + -} + | SuggestUseTypeFromDataKind + + {-| Suggests placing the 'qualified' keyword /after/ the module name. + + Triggered by: 'GHC.Parser.Errors.Types.PsWarnImportPreQualified' + Example: None + Test case(s): module/mod184.hs + + -} + | SuggestQualifiedAfterModuleName + + {-| Suggests using TemplateHaskell quotation syntax. + + Triggered by: 'GHC.Parser.Errors.Types.PsErrEmptyDoubleQuotes' only if TemplateHaskell + is enabled. + Example: None + Test case(s): parser/should_fail/T13450TH.hs + + -} + | SuggestThQuotationSyntax + + {-| Suggests alternative roles in case we found an illegal one. + + Triggered by: 'GHC.Parser.Errors.Types.PsErrIllegalRoleName' + Example: None + Test case(s): roles/should_fail/Roles7.hs + + -} + | SuggestRoles [Role] + + {-| Suggests qualifying the '*' operator in modules where StarIsType is enabled. + + Triggered by: 'GHC.Parser.Errors.Types.PsWarnStarBinder' + Test case(s): warnings/should_compile/StarBinder.hs + -} + | SuggestQualifyStarOperator + + {-| Suggests that a type signature should have form <variable> :: <type> + in order to be accepted by GHC. + + Triggered by: 'GHC.Parser.Errors.Types.PsErrInvalidTypeSignature' + Test case(s): parser/should_fail/T3811 + -} + | SuggestTypeSignatureForm -- | An 'InstantiationSuggestion' for a '.hsig' file. This is generated -- by GHC in case of a 'DriverUnexpectedSignature' and suggests a way diff --git a/compiler/GHC/Types/Hint/Ppr.hs b/compiler/GHC/Types/Hint/Ppr.hs index e6e1663fde..56d105dd53 100644 --- a/compiler/GHC/Types/Hint/Ppr.hs +++ b/compiler/GHC/Types/Hint/Ppr.hs @@ -9,6 +9,7 @@ module GHC.Types.Hint.Ppr ( import GHC.Prelude +import GHC.Parser.Errors.Basic import GHC.Types.Hint import GHC.Hs.Expr () -- instance Outputable @@ -50,6 +51,11 @@ instance Outputable GhcHint where text "replacing <" <> ppr pi_mod_name <> text "> as necessary." SuggestUseSpaces -> text "Please use spaces instead." + SuggestUseWhitespaceAfter sym + -> text "Add whitespace after the" + <+> quotes (pprOperatorWhitespaceSymbol sym) <> char '.' + SuggestUseWhitespaceAround sym _occurrence + -> text "Add whitespace around" <+> quotes (text sym) <> char '.' SuggestParentheses -> text "Use parentheses." SuggestIncreaseMaxPmCheckModels @@ -67,6 +73,29 @@ instance Outputable GhcHint where , whenPprDebug (ppr bad_rule) ] SuggestIncreaseSimplifierIterations -> text "Set limit with -fconstraint-solver-iterations=n; n=0 for no limit" + SuggestUseTypeFromDataKind + -> text "Use" <+> quotes (text "Type") + <+> text "from" <+> quotes (text "Data.Kind") <+> text "instead." + SuggestQualifiedAfterModuleName + -> text "Place" <+> quotes (text "qualified") + <+> text "after the module name." + SuggestThQuotationSyntax + -> vcat [ text "Perhaps you intended to use quotation syntax of TemplateHaskell," + , text "but the type variable or constructor is missing" + ] + SuggestRoles nearby + -> case nearby of + [] -> empty + [r] -> text "Perhaps you meant" <+> quotes (ppr r) + -- will this last case ever happen?? + _ -> hang (text "Perhaps you meant one of these:") + 2 (pprWithCommas (quotes . ppr) nearby) + SuggestQualifyStarOperator + -> text "To use (or export) this operator in" + <+> text "modules with StarIsType," + $$ text " including the definition module, you must qualify it." + SuggestTypeSignatureForm + -> text "A type signature should be of form <variables> :: <type>" perhapsAsPat :: SDoc perhapsAsPat = text "Perhaps you meant an as-pattern, which must not be surrounded by whitespace" diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index d9a079e4a3..1176aa9c89 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -492,6 +492,7 @@ Library GHC.Parser GHC.Parser.Annotation GHC.Parser.CharClass + GHC.Parser.Errors.Basic GHC.Parser.Errors.Ppr GHC.Parser.Errors.Types GHC.Parser.Header diff --git a/testsuite/tests/count-deps/CountDepsAst.stdout b/testsuite/tests/count-deps/CountDepsAst.stdout index 862040292f..e9ee86cf09 100644 --- a/testsuite/tests/count-deps/CountDepsAst.stdout +++ b/testsuite/tests/count-deps/CountDepsAst.stdout @@ -1,4 +1,4 @@ -Found 272 Language.Haskell.Syntax module dependencies +Found 273 Language.Haskell.Syntax module dependencies GHC.Builtin.Names GHC.Builtin.PrimOps GHC.Builtin.Types @@ -122,6 +122,7 @@ GHC.Iface.Syntax GHC.Iface.Type GHC.Linker.Types GHC.Parser.Annotation +GHC.Parser.Errors.Basic GHC.Parser.Errors.Ppr GHC.Parser.Errors.Types GHC.Parser.Types diff --git a/testsuite/tests/count-deps/CountDepsParser.stdout b/testsuite/tests/count-deps/CountDepsParser.stdout index 06579d319b..daaf8294a1 100644 --- a/testsuite/tests/count-deps/CountDepsParser.stdout +++ b/testsuite/tests/count-deps/CountDepsParser.stdout @@ -1,4 +1,4 @@ -Found 278 GHC.Parser module dependencies +Found 279 GHC.Parser module dependencies GHC.Builtin.Names GHC.Builtin.PrimOps GHC.Builtin.Types @@ -125,6 +125,7 @@ GHC.Linker.Types GHC.Parser GHC.Parser.Annotation GHC.Parser.CharClass +GHC.Parser.Errors.Basic GHC.Parser.Errors.Ppr GHC.Parser.Errors.Types GHC.Parser.Lexer diff --git a/testsuite/tests/linear/should_fail/LinearNoExt.stderr b/testsuite/tests/linear/should_fail/LinearNoExt.stderr index e4afbd1048..6bcb5425ed 100644 --- a/testsuite/tests/linear/should_fail/LinearNoExt.stderr +++ b/testsuite/tests/linear/should_fail/LinearNoExt.stderr @@ -1,3 +1,4 @@ LinearNoExt.hs:3:14: error: - Enable LinearTypes to allow linear functions + Illegal use of linear functions + Suggested fix: Perhaps you intended to use LinearTypes diff --git a/testsuite/tests/linear/should_fail/LinearNoExtU.stderr b/testsuite/tests/linear/should_fail/LinearNoExtU.stderr index ac187aee4a..4c6e3a9065 100644 --- a/testsuite/tests/linear/should_fail/LinearNoExtU.stderr +++ b/testsuite/tests/linear/should_fail/LinearNoExtU.stderr @@ -1,3 +1,4 @@ LinearNoExtU.hs:4:14: error: - Enable LinearTypes to allow linear functions + Illegal use of linear functions + Suggested fix: Perhaps you intended to use LinearTypes diff --git a/testsuite/tests/module/mod182.stderr b/testsuite/tests/module/mod182.stderr index 51886000de..437b080d48 100644 --- a/testsuite/tests/module/mod182.stderr +++ b/testsuite/tests/module/mod182.stderr @@ -1,4 +1,5 @@ mod182.hs:6:16: error: - Found ‘qualified’ in postpositive position. - To allow this, enable language extension 'ImportQualifiedPost' + Found ‘qualified’ in postpositive position. + Suggested fix: + Perhaps you intended to use ImportQualifiedPost diff --git a/testsuite/tests/module/mod184.stderr b/testsuite/tests/module/mod184.stderr index 8fe888c028..d83a316d18 100644 --- a/testsuite/tests/module/mod184.stderr +++ b/testsuite/tests/module/mod184.stderr @@ -1,5 +1,6 @@ mod184.hs:6:8: warning: [-Wprepositive-qualified-module] Found ‘qualified’ in prepositive position - Suggested fix: place ‘qualified’ after the module name instead. - To allow this, enable language extension 'ImportQualifiedPost' + Suggested fixes: + Place ‘qualified’ after the module name. + Perhaps you intended to use ImportQualifiedPost diff --git a/testsuite/tests/module/mod98.stderr b/testsuite/tests/module/mod98.stderr index b104cdae72..7af91a8775 100644 --- a/testsuite/tests/module/mod98.stderr +++ b/testsuite/tests/module/mod98.stderr @@ -1,4 +1,5 @@ mod98.hs:3:1: error: Invalid type signature: M.x :: ... - Should be of form <variables> :: <type> + Suggested fix: + A type signature should be of form <variables> :: <type> diff --git a/testsuite/tests/parser/should_compile/T18834a.stderr b/testsuite/tests/parser/should_compile/T18834a.stderr index 2fd8f5903d..71f90eff49 100644 --- a/testsuite/tests/parser/should_compile/T18834a.stderr +++ b/testsuite/tests/parser/should_compile/T18834a.stderr @@ -2,14 +2,14 @@ T18834a.hs:6:10: warning: [-Woperator-whitespace-ext-conflict (in -Wdefault)] The prefix use of a ‘$’ would denote an untyped splice were the TemplateHaskell extension enabled. - Suggested fix: add whitespace after the ‘$’. + Suggested fix: Add whitespace after the ‘$’. T18834a.hs:7:10: warning: [-Woperator-whitespace-ext-conflict (in -Wdefault)] The prefix use of a ‘$$’ would denote a typed splice were the TemplateHaskell extension enabled. - Suggested fix: add whitespace after the ‘$$’. + Suggested fix: Add whitespace after the ‘$$’. T18834a.hs:8:10: warning: [-Woperator-whitespace-ext-conflict (in -Wdefault)] The prefix use of a ‘%’ would denote a multiplicity annotation were the LinearTypes extension enabled. - Suggested fix: add whitespace after the ‘%’. + Suggested fix: Add whitespace after the ‘%’. diff --git a/testsuite/tests/parser/should_compile/T18834b.stderr b/testsuite/tests/parser/should_compile/T18834b.stderr index 9ec4f81bb4..4dc54cfb26 100644 --- a/testsuite/tests/parser/should_compile/T18834b.stderr +++ b/testsuite/tests/parser/should_compile/T18834b.stderr @@ -2,14 +2,14 @@ T18834b.hs:5:10: warning: [-Woperator-whitespace] The suffix use of a ‘+’ might be repurposed as special syntax by a future language extension. - Suggested fix: add whitespace around it. + Suggested fix: Add whitespace around ‘+’. T18834b.hs:6:11: warning: [-Woperator-whitespace] The prefix use of a ‘+’ might be repurposed as special syntax by a future language extension. - Suggested fix: add whitespace around it. + Suggested fix: Add whitespace around ‘+’. T18834b.hs:7:10: warning: [-Woperator-whitespace] The tight infix use of a ‘+’ might be repurposed as special syntax by a future language extension. - Suggested fix: add whitespace around it. + Suggested fix: Add whitespace around ‘+’. diff --git a/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr b/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr index 6c96fc9679..26b8d8c617 100644 --- a/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr +++ b/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr @@ -2,4 +2,4 @@ NoDoAndIfThenElse.hs:7:13: Unexpected semi-colons in conditional: if True; then return (); else return () - Perhaps you meant to use DoAndIfThenElse? + Suggested fix: Perhaps you intended to use DoAndIfThenElse diff --git a/testsuite/tests/parser/should_fail/NoNumericUnderscores0.stderr b/testsuite/tests/parser/should_fail/NoNumericUnderscores0.stderr index af59581c14..ffe4a3f1dc 100644 --- a/testsuite/tests/parser/should_fail/NoNumericUnderscores0.stderr +++ b/testsuite/tests/parser/should_fail/NoNumericUnderscores0.stderr @@ -1,3 +1,4 @@ NoNumericUnderscores0.hs:11:3: error: - Use NumericUnderscores to allow underscores in integer literals + Illegal underscores in integer literals + Suggested fix: Perhaps you intended to use NumericUnderscores diff --git a/testsuite/tests/parser/should_fail/NoNumericUnderscores1.stderr b/testsuite/tests/parser/should_fail/NoNumericUnderscores1.stderr index 0dfbaa409e..242d10f22b 100644 --- a/testsuite/tests/parser/should_fail/NoNumericUnderscores1.stderr +++ b/testsuite/tests/parser/should_fail/NoNumericUnderscores1.stderr @@ -1,3 +1,4 @@ NoNumericUnderscores1.hs:11:3: error: - Use NumericUnderscores to allow underscores in floating literals + Illegal underscores in floating literals + Suggested fix: Perhaps you intended to use NumericUnderscores diff --git a/testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr b/testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr index b4ca84e3b3..1785a14fc2 100644 --- a/testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr +++ b/testsuite/tests/parser/should_fail/NoPatternSynonyms.stderr @@ -1,4 +1,4 @@ NoPatternSynonyms.hs:3:1: error: Invalid type signature: pattern P :: ... - Perhaps you meant to use PatternSynonyms? + Suggested fix: Perhaps you intended to use PatternSynonyms diff --git a/testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr b/testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr index 601262c360..df4cb72d0f 100644 --- a/testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr +++ b/testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr @@ -1,2 +1,3 @@ ParserNoLambdaCase.hs:3:6: - Illegal lambda-case (use LambdaCase) + Illegal lambda-case + Suggested fix: Perhaps you intended to use LambdaCase diff --git a/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr b/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr index 64d70520b0..22258fa51c 100644 --- a/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr +++ b/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr @@ -1,3 +1,4 @@ ParserNoMultiWayIf.hs:4:5: - Multi-way if-expressions need MultiWayIf turned on + Illegal multi-way if-expression + Suggested fix: Perhaps you intended to use MultiWayIf diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail2.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail2.stderr index 5430e37bc9..430bb53a5e 100644 --- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail2.stderr +++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail2.stderr @@ -1,2 +1,3 @@ RecordDotSyntaxFail2.hs:10:10: - OverloadedRecordUpdate needs to be enabled + Illegal overloaded record update + Suggested fix: Perhaps you intended to use OverloadedRecordUpdate diff --git a/testsuite/tests/parser/should_fail/T13450TH.stderr b/testsuite/tests/parser/should_fail/T13450TH.stderr index 11733c5c91..1d6fdfbb1a 100644 --- a/testsuite/tests/parser/should_fail/T13450TH.stderr +++ b/testsuite/tests/parser/should_fail/T13450TH.stderr @@ -2,5 +2,6 @@ T13450TH.hs:6:15: error: Parser error on `''` Character literals may not be empty - Or perhaps you intended to use quotation syntax of TemplateHaskell, - but the type variable or constructor is missing + Suggested fix: + Perhaps you intended to use quotation syntax of TemplateHaskell, + but the type variable or constructor is missing diff --git a/testsuite/tests/parser/should_fail/T14588.stderr b/testsuite/tests/parser/should_fail/T14588.stderr index d4bf505703..04e4478198 100644 --- a/testsuite/tests/parser/should_fail/T14588.stderr +++ b/testsuite/tests/parser/should_fail/T14588.stderr @@ -1,4 +1,5 @@ T14588.hs:4:19: error: - Illegal bang-pattern (use BangPatterns): + Illegal bang-pattern !x + Suggested fix: Perhaps you intended to use BangPatterns diff --git a/testsuite/tests/parser/should_fail/T16270.stderr b/testsuite/tests/parser/should_fail/T16270.stderr index 40a986879e..578add9682 100644 --- a/testsuite/tests/parser/should_fail/T16270.stderr +++ b/testsuite/tests/parser/should_fail/T16270.stderr @@ -9,7 +9,7 @@ T16270.hs:8:1: warning: [-Wtabs (in -Wdefault)] T16270.hs:8:12: error: Unexpected semi-colons in conditional: if c then False; else True - Perhaps you meant to use DoAndIfThenElse? + Suggested fix: Perhaps you intended to use DoAndIfThenElse T16270.hs:13:8: error: Unexpected do block in function application: @@ -26,12 +26,14 @@ T16270.hs:14:8: error: Perhaps you intended to use BlockArguments T16270.hs:18:22: error: - Illegal record syntax (use TraditionalRecordSyntax): {fst :: a, - snd :: b} + Illegal record syntax: {fst :: a, + snd :: b} + Suggested fix: Perhaps you intended to use TraditionalRecordSyntax T16270.hs:19:5: error: - Illegal record syntax (use TraditionalRecordSyntax): p {fst = 1, - snd = True} + Illegal record syntax: p {fst = 1, + snd = True} + Suggested fix: Perhaps you intended to use TraditionalRecordSyntax T16270.hs:21:6: error: Illegal symbol ‘forall’ in type @@ -41,7 +43,7 @@ T16270.hs:21:6: error: T16270.hs:22:8: error: Unexpected semi-colons in conditional: if True; then (); else () - Perhaps you meant to use DoAndIfThenElse? + Suggested fix: Perhaps you intended to use DoAndIfThenElse T16270.hs:24:10: error: Illegal keyword 'where' in data declaration @@ -49,19 +51,25 @@ T16270.hs:24:10: error: extension to enable syntax: data T where T16270.hs:26:12: error: - Illegal bang-pattern (use BangPatterns): + Illegal bang-pattern !i + Suggested fix: Perhaps you intended to use BangPatterns T16270.hs:28:9: error: - Multi-way if-expressions need MultiWayIf turned on + Illegal multi-way if-expression + Suggested fix: Perhaps you intended to use MultiWayIf T16270.hs:30:9: error: - Multi-way if-expressions need MultiWayIf turned on + Illegal multi-way if-expression + Suggested fix: Perhaps you intended to use MultiWayIf -T16270.hs:33:6: error: Illegal lambda-case (use LambdaCase) +T16270.hs:33:6: + Illegal lambda-case + Suggested fix: Perhaps you intended to use LambdaCase T16270.hs:36:5: error: - Use NumericUnderscores to allow underscores in integer literals + Illegal underscores in integer literals + Suggested fix: Perhaps you intended to use NumericUnderscores T16270.hs:38:5: error: primitive string literal must contain only characters <= '\xFF' diff --git a/testsuite/tests/parser/should_fail/T16270h.stderr b/testsuite/tests/parser/should_fail/T16270h.stderr index fb7fc43a17..f723d594da 100644 --- a/testsuite/tests/parser/should_fail/T16270h.stderr +++ b/testsuite/tests/parser/should_fail/T16270h.stderr @@ -1,6 +1,7 @@ T16270h.hs:8:22: error: - Illegal keyword 'type' (use ExplicitNamespaces to enable) + Illegal keyword 'type' + Suggested fix: Perhaps you intended to use ExplicitNamespaces T16270h.hs:10:8: error: Parse error: ‘pkg?’ diff --git a/testsuite/tests/parser/should_fail/T17162.stderr b/testsuite/tests/parser/should_fail/T17162.stderr index ff6cfb99c4..1eef0ea346 100644 --- a/testsuite/tests/parser/should_fail/T17162.stderr +++ b/testsuite/tests/parser/should_fail/T17162.stderr @@ -1,4 +1,5 @@ T17162.hs:7:21: error: - Illegal bang-pattern (use BangPatterns): + Illegal bang-pattern !enc + Suggested fix: Perhaps you intended to use BangPatterns diff --git a/testsuite/tests/parser/should_fail/T3811.stderr b/testsuite/tests/parser/should_fail/T3811.stderr index 90810949ed..f0209ba85f 100644 --- a/testsuite/tests/parser/should_fail/T3811.stderr +++ b/testsuite/tests/parser/should_fail/T3811.stderr @@ -1,4 +1,5 @@ T3811.hs:4:1: error: Invalid type signature: f x :: ... - Should be of form <variables> :: <type> + Suggested fix: + A type signature should be of form <variables> :: <type> diff --git a/testsuite/tests/parser/should_fail/T3811e.stderr b/testsuite/tests/parser/should_fail/T3811e.stderr index e98be9ffe6..10cd25f9e8 100644 --- a/testsuite/tests/parser/should_fail/T3811e.stderr +++ b/testsuite/tests/parser/should_fail/T3811e.stderr @@ -1,4 +1,4 @@ T3811e.hs:6:6: - Illegal datatype context (use DatatypeContexts): (Show a, - Read a) => + Illegal datatype context: (Show a, Read a) => + Suggested fix: Perhaps you intended to use DatatypeContexts diff --git a/testsuite/tests/parser/should_fail/proposal-229c.stderr b/testsuite/tests/parser/should_fail/proposal-229c.stderr index 965801a3c3..47753c88dd 100644 --- a/testsuite/tests/parser/should_fail/proposal-229c.stderr +++ b/testsuite/tests/parser/should_fail/proposal-229c.stderr @@ -1,4 +1,5 @@ proposal-229c.hs:6:3: error: - Illegal bang-pattern (use BangPatterns): + Illegal bang-pattern !x + Suggested fix: Perhaps you intended to use BangPatterns diff --git a/testsuite/tests/parser/should_fail/readFail031.stderr b/testsuite/tests/parser/should_fail/readFail031.stderr index 5239948bf8..eaf9058c72 100644 --- a/testsuite/tests/parser/should_fail/readFail031.stderr +++ b/testsuite/tests/parser/should_fail/readFail031.stderr @@ -1,4 +1,5 @@ readFail031.hs:4:3: error: Invalid type signature: (:+) :: ... - Should be of form <variables> :: <type> + Suggested fix: + A type signature should be of form <variables> :: <type> diff --git a/testsuite/tests/parser/should_fail/readFailTraditionalRecords1.stderr b/testsuite/tests/parser/should_fail/readFailTraditionalRecords1.stderr index 34cda9c264..9a8ed3ae84 100644 --- a/testsuite/tests/parser/should_fail/readFailTraditionalRecords1.stderr +++ b/testsuite/tests/parser/should_fail/readFailTraditionalRecords1.stderr @@ -1,3 +1,4 @@ readFailTraditionalRecords1.hs:6:16: - Illegal record syntax (use TraditionalRecordSyntax): {i :: Int} + Illegal record syntax: {i :: Int} + Suggested fix: Perhaps you intended to use TraditionalRecordSyntax diff --git a/testsuite/tests/parser/should_fail/readFailTraditionalRecords2.stderr b/testsuite/tests/parser/should_fail/readFailTraditionalRecords2.stderr index 771b345a70..91f9a590b0 100644 --- a/testsuite/tests/parser/should_fail/readFailTraditionalRecords2.stderr +++ b/testsuite/tests/parser/should_fail/readFailTraditionalRecords2.stderr @@ -1,3 +1,4 @@ readFailTraditionalRecords2.hs:6:4: - Illegal record syntax (use TraditionalRecordSyntax): Foo {i = j} + Illegal record syntax: Foo {i = j} + Suggested fix: Perhaps you intended to use TraditionalRecordSyntax diff --git a/testsuite/tests/parser/should_fail/readFailTraditionalRecords3.stderr b/testsuite/tests/parser/should_fail/readFailTraditionalRecords3.stderr index 0317935c0b..b741512b3b 100644 --- a/testsuite/tests/parser/should_fail/readFailTraditionalRecords3.stderr +++ b/testsuite/tests/parser/should_fail/readFailTraditionalRecords3.stderr @@ -1,3 +1,4 @@ readFailTraditionalRecords3.hs:6:7: - Illegal record syntax (use TraditionalRecordSyntax): x {i = 3} + Illegal record syntax: x {i = 3} + Suggested fix: Perhaps you intended to use TraditionalRecordSyntax diff --git a/testsuite/tests/patsyn/should_fail/export-syntax.stderr b/testsuite/tests/patsyn/should_fail/export-syntax.stderr index 8843a6a395..35858bce0d 100644 --- a/testsuite/tests/patsyn/should_fail/export-syntax.stderr +++ b/testsuite/tests/patsyn/should_fail/export-syntax.stderr @@ -1,3 +1,4 @@ export-syntax.hs:1:12: error: - Illegal export form (use PatternSynonyms to enable) + Illegal export form + Suggested fix: Perhaps you intended to use PatternSynonyms diff --git a/testsuite/tests/qualifieddo/should_fail/qdofail002.stderr b/testsuite/tests/qualifieddo/should_fail/qdofail002.stderr index 5948678eb8..bea64513c6 100644 --- a/testsuite/tests/qualifieddo/should_fail/qdofail002.stderr +++ b/testsuite/tests/qualifieddo/should_fail/qdofail002.stderr @@ -1,8 +1,8 @@ qdofail002.hs:8:11: Illegal qualified ‘P.do’ block - Perhaps you intended to use QualifiedDo + Suggested fix: Perhaps you intended to use QualifiedDo qdofail002.hs:11:13: Illegal qualified ‘P.mdo’ block - Perhaps you intended to use QualifiedDo + Suggested fix: Perhaps you intended to use QualifiedDo diff --git a/testsuite/tests/roles/should_fail/Roles7.stderr b/testsuite/tests/roles/should_fail/Roles7.stderr index ae62543e28..c8840136d7 100644 --- a/testsuite/tests/roles/should_fail/Roles7.stderr +++ b/testsuite/tests/roles/should_fail/Roles7.stderr @@ -1,4 +1,4 @@ Roles7.hs:6:15: Illegal role name ‘repesentational’ - Perhaps you meant ‘representational’ + Suggested fix: Perhaps you meant ‘representational’ diff --git a/testsuite/tests/warnings/should_compile/StarBinder.stderr b/testsuite/tests/warnings/should_compile/StarBinder.stderr index a8bdc9b6e5..64bd8a3fbc 100644 --- a/testsuite/tests/warnings/should_compile/StarBinder.stderr +++ b/testsuite/tests/warnings/should_compile/StarBinder.stderr @@ -1,10 +1,12 @@ StarBinder.hs:6:14: warning: [-Wstar-binder (in -Wdefault)] Found binding occurrence of ‘*’ yet StarIsType is enabled. - NB. To use (or export) this operator in modules with StarIsType, + Suggested fix: + To use (or export) this operator in modules with StarIsType, including the definition module, you must qualify it. StarBinder.hs:6:30: warning: [-Wstar-binder (in -Wdefault)] Found binding occurrence of ‘*’ yet StarIsType is enabled. - NB. To use (or export) this operator in modules with StarIsType, + Suggested fix: + To use (or export) this operator in modules with StarIsType, including the definition module, you must qualify it. diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr index 6c3555797d..1b3c2ff34b 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr @@ -20,4 +20,4 @@ Template.hs:20:15: warning: [-Wstar-is-type (in -Wall, -Wcompat)] Using ‘*’ (or its Unicode variant) to mean ‘Data.Kind.Type’ relies on the StarIsType extension, which will become deprecated in the future. - Suggested fix: use ‘Type’ from ‘Data.Kind’ instead. + Suggested fix: Use ‘Type’ from ‘Data.Kind’ instead. |