diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Driver/DynFlags.hs | 14 | ||||
-rw-r--r-- | compiler/GHC/Driver/Flags.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 12 | ||||
-rw-r--r-- | compiler/GHC/Hs/Type.hs | 20 | ||||
-rw-r--r-- | compiler/GHC/Rename/Bind.hs | 9 | ||||
-rw-r--r-- | compiler/GHC/Rename/Expr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Rename/HsType.hs | 45 | ||||
-rw-r--r-- | compiler/GHC/Rename/Module.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Tc/Deriv.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Tc/Deriv/Generate.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Tc/Errors/Ppr.hs | 22 | ||||
-rw-r--r-- | compiler/GHC/Tc/Errors/Types.hs | 27 | ||||
-rw-r--r-- | compiler/GHC/Types/Error/Codes.hs | 2 |
13 files changed, 121 insertions, 46 deletions
diff --git a/compiler/GHC/Driver/DynFlags.hs b/compiler/GHC/Driver/DynFlags.hs index 01aa518452..34e702e5ba 100644 --- a/compiler/GHC/Driver/DynFlags.hs +++ b/compiler/GHC/Driver/DynFlags.hs @@ -1351,8 +1351,9 @@ languageExtensions (Just Haskell98) -- turning it off breaks code, so we're keeping it on for -- backwards compatibility. Cabal uses -XHaskell98 by -- default unless you specify another language. - LangExt.DeepSubsumption + LangExt.DeepSubsumption, -- Non-standard but enabled for backwards compatability (see GHC proposal #511) + LangExt.ImplicitForAll ] languageExtensions (Just Haskell2010) @@ -1369,7 +1370,8 @@ languageExtensions (Just Haskell2010) LangExt.DoAndIfThenElse, LangExt.FieldSelectors, LangExt.RelaxedPolyRec, - LangExt.DeepSubsumption ] + LangExt.DeepSubsumption, + LangExt.ImplicitForAll] languageExtensions (Just GHC2021) = [LangExt.ImplicitPrelude, @@ -1383,6 +1385,7 @@ languageExtensions (Just GHC2021) LangExt.DoAndIfThenElse, LangExt.FieldSelectors, LangExt.RelaxedPolyRec, + LangExt.ImplicitForAll, -- Now the new extensions (not in Haskell2010) LangExt.BangPatterns, LangExt.BinaryLiterals, @@ -1415,12 +1418,15 @@ languageExtensions (Just GHC2021) LangExt.RankNTypes, LangExt.ScopedTypeVariables, LangExt.TypeAbstractions, -- implied by ScopedTypeVariables according to GHC Proposal #448 "Modern Scoped Type Variables" + LangExt.TypeSynonymInstances, -- implied by ScopedTypeVariables according to ^ + LangExt.PatternSignatures, -- implied by ScopedTypeVariables according to ^ + LangExt.MethodTypeVariables, -- implied by ScopedTypeVariables according to ^ + LangExt.ExtendedForAllScope, -- implied by ScopedTypeVariables according to ^ LangExt.StandaloneDeriving, LangExt.StandaloneKindSignatures, LangExt.TupleSections, LangExt.TypeApplications, - LangExt.TypeOperators, - LangExt.TypeSynonymInstances] + LangExt.TypeOperators] ways :: DynFlags -> Ways diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index 759c137eb5..8d33c63c95 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -637,6 +637,7 @@ data WarningFlag = | Opt_WarnLoopySuperclassSolve -- Since 9.6 | Opt_WarnTermVariableCapture -- Since 9.8 | Opt_WarnMissingRoleAnnotations -- Since 9.8 + | Opt_WarnPatternSignatureBinds -- Since 9.8 deriving (Eq, Ord, Show, Enum) -- | Return the names of a WarningFlag @@ -744,6 +745,7 @@ warnFlagNames wflag = case wflag of Opt_WarnLoopySuperclassSolve -> "loopy-superclass-solve" :| [] Opt_WarnTypeEqualityRequiresOperators -> "type-equality-requires-operators" :| [] Opt_WarnMissingRoleAnnotations -> "missing-role-annotations" :| [] + Opt_WarnPatternSignatureBinds -> "pattern-signature-binds" :| [] -- ----------------------------------------------------------------------------- -- Standard sets of warning options diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index dd5bb6b7cb..8199755765 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -2250,7 +2250,8 @@ wWarningFlagsDeps = mconcat [ warnSpec Opt_WarnTypeEqualityOutOfScope, warnSpec Opt_WarnTypeEqualityRequiresOperators, warnSpec Opt_WarnTermVariableCapture, - warnSpec Opt_WarnMissingRoleAnnotations + warnSpec Opt_WarnMissingRoleAnnotations, + warnSpec Opt_WarnPatternSignatureBinds ] warningGroupsDeps :: [(Deprecation, FlagSpec WarningGroup)] @@ -2663,8 +2664,10 @@ xFlagsDeps = [ flagSpec "ParallelListComp" LangExt.ParallelListComp, flagSpec "PartialTypeSignatures" LangExt.PartialTypeSignatures, flagSpec "PatternGuards" LangExt.PatternGuards, - depFlagSpec' "PatternSignatures" LangExt.ScopedTypeVariables - (deprecatedForExtension "ScopedTypeVariables"), + flagSpec "PatternSignatures" LangExt.PatternSignatures, + flagSpec "MethodTypeVariables" LangExt.MethodTypeVariables, + flagSpec "ExtendedForAllScope" LangExt.ExtendedForAllScope, + flagSpec "ImplicitForAll" LangExt.ImplicitForAll, flagSpec "PatternSynonyms" LangExt.PatternSynonyms, flagSpec "PolyKinds" LangExt.PolyKinds, flagSpec "PolymorphicComponents" LangExt.RankNTypes, @@ -2757,6 +2760,9 @@ impliedXFlags -- In accordance with GHC Proposal #448 "Modern Scoped Type Variables" , (LangExt.ScopedTypeVariables, turnOn, LangExt.TypeAbstractions) + , (LangExt.ScopedTypeVariables, turnOn, LangExt.PatternSignatures) + , (LangExt.ScopedTypeVariables, turnOn, LangExt.MethodTypeVariables) + , (LangExt.ScopedTypeVariables, turnOn, LangExt.ExtendedForAllScope) , (LangExt.RebindableSyntax, turnOff, LangExt.ImplicitPrelude) -- NB: turn off! diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index eb3a955269..3b99b14aae 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -819,9 +819,9 @@ enabled. For example, the following will be rejected: instance (Eq a => Show (Maybe a)) where ... This restriction is partly motivated by an unusual quirk of instance -declarations. Namely, if ScopedTypeVariables is enabled, then the type -variables from the top of an instance will scope over the bodies of the -instance methods, /even if the type variables are implicitly quantified/. +declarations. Namely, if MethodTypeVariables (impied by ScopedTypeVariables) is enabled, +then the type variables from the top of an instance will scope over the bodies +of the instance methods, /even if the type variables are implicitly quantified/. For example, GHC will accept the following: instance Monoid a => Monoid (Identity a) where @@ -841,20 +841,20 @@ Somewhat surprisingly, old versions of GHC would accept the instance above. Even though the `forall` only quantifies `a`, the outermost parentheses mean that the `forall` is nested, and per the forall-or-nothing rule, this means that implicit quantification would occur. Therefore, the `a` is explicitly -bound and the `b` is implicitly bound. Moreover, ScopedTypeVariables would -bring /both/ sorts of type variables into scope over the body of `m`. +bound and the `b` is implicitly bound. Moreover, MethodTypeVariables +would bring /both/ sorts of type variables into scope over the body of `m`. How utterly confusing! To avoid this sort of confusion, we simply disallow nested `forall`s in instance types, which makes things like the instance above become illegal. For the sake of consistency, we also disallow nested contexts, even though they -don't have the same strange interaction with ScopedTypeVariables. +don't have the same strange interaction with MethodTypeVariables. Just as we forbid nested `forall`s and contexts in normal instance declarations, we also forbid them in SPECIALISE instance pragmas (#18455). -Unlike normal instance declarations, ScopedTypeVariables don't have any impact -on SPECIALISE instance pragmas, but we use the same validity checks for -SPECIALISE instance pragmas anyway to be consistent. +Unlike normal instance declarations, MethodTypeVariables +don't have any impact on SPECIALISE instance pragmas, but we use the same +validity checks for SPECIALISE instance pragmas anyway to be consistent. ----- -- Wrinkle: Derived instances @@ -863,7 +863,7 @@ SPECIALISE instance pragmas anyway to be consistent. `deriving` clauses and standalone `deriving` declarations also permit bringing type variables into scope, either through explicit or implicit quantification. Unlike in the tops of instance declarations, however, one does not need to -enable ScopedTypeVariables for this to take effect. +enable MethodTypeVariables for this to take effect. Just as GHC forbids nested `forall`s in the top of instance declarations, it also forbids them in types involved with `deriving`: diff --git a/compiler/GHC/Rename/Bind.hs b/compiler/GHC/Rename/Bind.hs index 73af997a2e..80736c0a34 100644 --- a/compiler/GHC/Rename/Bind.hs +++ b/compiler/GHC/Rename/Bind.hs @@ -519,7 +519,7 @@ rnBind sig_fn bind@(FunBind { fun_id = name -- invariant: no free vars here when it's a FunBind = do { let plain_name = unLoc name - ; (matches', rhs_fvs) <- bindSigTyVarsFV (sig_fn plain_name) $ + ; (matches', rhs_fvs) <- bindSigTyVarsFVExtended (sig_fn plain_name) $ -- bindSigTyVars tests for LangExt.ScopedTyVars rnMatchGroup (mkPrefixFunRhs name) rnLExpr matches @@ -726,7 +726,7 @@ rnPatSynBind sig_fn bind@(PSB { psb_id = L l name ; unless pattern_synonym_ok (addErr TcRnIllegalPatternSynonymDecl) ; let scoped_tvs = sig_fn name - ; ((pat', details'), fvs1) <- bindSigTyVarsFV scoped_tvs $ + ; ((pat', details'), fvs1) <- bindSigTyVarsFVExtended scoped_tvs $ rnPat PatSyn pat $ \pat' -> -- We check the 'RdrName's instead of the 'Name's -- so that the binding locations are reported @@ -763,7 +763,7 @@ rnPatSynBind sig_fn bind@(PSB { psb_id = L l name Unidirectional -> return (Unidirectional, emptyFVs) ImplicitBidirectional -> return (ImplicitBidirectional, emptyFVs) ExplicitBidirectional mg -> - do { (mg', fvs) <- bindSigTyVarsFV scoped_tvs $ + do { (mg', fvs) <- bindSigTyVarsFVExtended scoped_tvs $ rnMatchGroup (mkPrefixFunRhs (L l name)) rnLExpr mg ; return (ExplicitBidirectional mg', fvs) } @@ -920,7 +920,8 @@ rnMethodBinds is_cls_decl cls ktv_names binds sigs -- Rename the bindings RHSs. Again there's an issue about whether the -- type variables from the class/instance head are in scope. -- Answer no in Haskell 2010, but yes if you have -XScopedTypeVariables - ; (binds'', bind_fvs) <- bindSigTyVarsFV ktv_names $ + -- or -XMethodTypeVariables + ; (binds'', bind_fvs) <- bindSigTyVarsFVMethod ktv_names $ do { binds_w_dus <- mapBagM (rnLBind (mkScopedTvFn other_sigs')) binds' ; let bind_fvs = foldr (\(_,_,fv1) fv2 -> fv1 `plusFV` fv2) emptyFVs binds_w_dus diff --git a/compiler/GHC/Rename/Expr.hs b/compiler/GHC/Rename/Expr.hs index 2afc0f0fa6..184b5f8550 100644 --- a/compiler/GHC/Rename/Expr.hs +++ b/compiler/GHC/Rename/Expr.hs @@ -521,7 +521,7 @@ rnExpr (HsRecSel x _) = dataConCantHappen x rnExpr (ExprWithTySig _ expr pty) = do { (pty', fvTy) <- rnHsSigWcType ExprWithTySigCtx pty - ; (expr', fvExpr) <- bindSigTyVarsFV (hsWcScopedTvs pty') $ + ; (expr', fvExpr) <- bindSigTyVarsFVExtended (hsWcScopedTvs pty') $ rnLExpr expr ; return (ExprWithTySig noExtField expr' pty', fvExpr `plusFV` fvTy) } diff --git a/compiler/GHC/Rename/HsType.hs b/compiler/GHC/Rename/HsType.hs index 049bbe2c22..7ab390615a 100644 --- a/compiler/GHC/Rename/HsType.hs +++ b/compiler/GHC/Rename/HsType.hs @@ -31,7 +31,8 @@ module GHC.Rename.HsType ( -- Binding related stuff bindHsOuterTyVarBndrs, bindHsForAllTelescope, bindLHsTyVarBndr, bindLHsTyVarBndrs, WarnUnusedForalls(..), - rnImplicitTvOccs, bindSigTyVarsFV, bindHsQTyVars, + rnImplicitTvOccs, bindSigTyVarsFVExtended, bindSigTyVarsFVMethod, + bindHsQTyVars, FreeKiTyVars, filterInScopeM, extractHsTyRdrTyVars, extractHsTyRdrTyVarsKindVars, extractHsTysRdrTyVars, extractRdrKindSigVars, @@ -150,14 +151,14 @@ rnHsPatSigType :: HsPatSigTypeScoping -> (HsPatSigType GhcRn -> RnM (a, FreeVars)) -> RnM (a, FreeVars) -- Used for --- - Pattern type signatures, which are only allowed with ScopedTypeVariables +-- - Pattern type signatures, which are only allowed with PatternSignatures -- - Signatures on binders in a RULE, which are allowed even if --- ScopedTypeVariables isn't enabled +-- PatternSignatures isn't enabled -- Wildcards are allowed -- -- See Note [Pattern signature binders and scoping] in GHC.Hs.Type rnHsPatSigType scoping ctx sig_ty thing_inside - = do { ty_sig_okay <- xoptM LangExt.ScopedTypeVariables + = do { ty_sig_okay <- xoptM LangExt.PatternSignatures ; checkErr ty_sig_okay (unexpectedPatSigTypeErr sig_ty) ; free_vars <- filterInScopeM (extractHsTyRdrTyVars pat_sig_ty) ; (nwc_rdrs', tv_rdrs) <- partition_nwcs free_vars @@ -165,6 +166,9 @@ rnHsPatSigType scoping ctx sig_ty thing_inside implicit_bndrs = case scoping of AlwaysBind -> tv_rdrs NeverBind -> [] + ; let i_bndrs = nubN implicit_bndrs in + unless (null i_bndrs) $ + addDiagnostic (TcRnPatternSignatureBinds i_bndrs) ; rnImplicitTvOccs Nothing implicit_bndrs $ \ imp_tvs -> do { (nwcs, pat_sig_ty', fvs1) <- rnWcBody ctx nwc_rdrs pat_sig_ty ; let sig_names = HsPSRn { hsps_nwcs = nwcs, hsps_imp_tvs = imp_tvs } @@ -386,6 +390,10 @@ rnImplicitTvOccs :: Maybe assoc -> RnM (a, FreeVars) rnImplicitTvOccs mb_assoc implicit_vs_with_dups thing_inside = do { let implicit_vs = nubN implicit_vs_with_dups + ; unlessXOptM LangExt.ImplicitForAll $ + unless (null implicit_vs) $ + addErr (TcRnImplicitForAll implicit_vs) + ; mapM_ warn_term_var_capture implicit_vs ; traceRn "rnImplicitTvOccs" $ @@ -900,18 +908,27 @@ notInKinds _ _ = return () * * ***************************************************** -} -bindSigTyVarsFV :: [Name] - -> RnM (a, FreeVars) - -> RnM (a, FreeVars) +bindSigTyVarsFVExtended, bindSigTyVarsFVMethod :: [Name] + -> RnM (a, FreeVars) + -> RnM (a, FreeVars) -- Used just before renaming the defn of a function -- with a separate type signature, to bring its tyvars into scope --- With no -XScopedTypeVariables, this is a no-op -bindSigTyVarsFV tvs thing_inside - = do { scoped_tyvars <- xoptM LangExt.ScopedTypeVariables - ; if not scoped_tyvars then - thing_inside - else - bindLocalNamesFV tvs thing_inside } +-- With no -XExtendedForAllScope/-XMethodTypeVariables, this is a no-op +(bindSigTyVarsFVExtended, bindSigTyVarsFVMethod) + = ( bindSigTyVarsFVIfEnabled LangExt.ExtendedForAllScope + , bindSigTyVarsFVIfEnabled LangExt.MethodTypeVariables + ) + where + bindSigTyVarsFVIfEnabled :: LangExt.Extension + -> [Name] + -> RnM (a, FreeVars) + -> RnM (a, FreeVars) + bindSigTyVarsFVIfEnabled lang_ext tvs thing_inside + = do { can_tyvars_be_in_scope <- xoptM lang_ext + ; if not can_tyvars_be_in_scope then + thing_inside + else + bindLocalNamesFV tvs thing_inside } --------------- bindHsQTyVars :: forall a b. diff --git a/compiler/GHC/Rename/Module.hs b/compiler/GHC/Rename/Module.hs index 319dececdd..69e312a6e3 100644 --- a/compiler/GHC/Rename/Module.hs +++ b/compiler/GHC/Rename/Module.hs @@ -198,7 +198,7 @@ rnSrcDecls group@(HsGroup { hs_valds = val_decls, -- (H) Rename Everything else - (rn_rule_decls, src_fvs2) <- setXOptM LangExt.ScopedTypeVariables $ + (rn_rule_decls, src_fvs2) <- setXOptM LangExt.PatternSignatures $ rnList rnHsRuleDecls rule_decls ; -- Inside RULES, scoped type variables are on (rn_foreign_decls, src_fvs3) <- rnList rnHsForeignDecl foreign_decls ; diff --git a/compiler/GHC/Tc/Deriv.hs b/compiler/GHC/Tc/Deriv.hs index 4d7bf81f6c..b5cb247d02 100644 --- a/compiler/GHC/Tc/Deriv.hs +++ b/compiler/GHC/Tc/Deriv.hs @@ -273,7 +273,9 @@ renameDeriv inst_infos bagBinds setXOptM LangExt.EmptyCase $ -- Derived decls (for empty types) can have -- case x of {} - setXOptM LangExt.ScopedTypeVariables $ + setXOptM LangExt.MethodTypeVariables $ + setXOptM LangExt.PatternSignatures $ + setXOptM LangExt.ExtendedForAllScope $ setXOptM LangExt.KindSignatures $ -- Derived decls (for newtype-deriving) can use ScopedTypeVariables & -- KindSignatures diff --git a/compiler/GHC/Tc/Deriv/Generate.hs b/compiler/GHC/Tc/Deriv/Generate.hs index 9a76c82b8f..b8678e4344 100644 --- a/compiler/GHC/Tc/Deriv/Generate.hs +++ b/compiler/GHC/Tc/Deriv/Generate.hs @@ -1875,9 +1875,9 @@ of the method. For example, recall: join In the example above, it is imperative that the `a` in the instance signature -for `join` scope over the body of `join` by way of ScopedTypeVariables. -This might sound obvious, but note that in gen_Newtype_binds, which is -responsible for generating the code above, the type in `join`'s instance +for `join` scope over the body of `join` by way of ExtendedForallScope (implied +by ScopedTypeVariables). This might sound obvious, but note that in gen_Newtype_binds, +which is responsible for generating the code above, the type in `join`'s instance signature is given as a Core type, whereas gen_Newtype_binds will eventually produce HsBinds (i.e., source Haskell) that is renamed and typechecked. We must ensure that `a` is in scope over the body of `join` during renaming 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. diff --git a/compiler/GHC/Types/Error/Codes.hs b/compiler/GHC/Types/Error/Codes.hs index 25f78f9fbd..0a6e85a6bd 100644 --- a/compiler/GHC/Types/Error/Codes.hs +++ b/compiler/GHC/Types/Error/Codes.hs @@ -600,6 +600,8 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnBindingNameConflict" = 10498 GhcDiagnosticCode "NonCanonicalMonoid" = 50928 GhcDiagnosticCode "NonCanonicalMonad" = 22705 + GhcDiagnosticCode "TcRnImplicitForAll" = 78543 + GhcDiagnosticCode "TcRnPatternSignatureBinds" = 65467 GhcDiagnosticCode "TcRnUnexpectedDeclarationSplice" = 17599 GhcDiagnosticCode "TcRnImplicitImportOfPrelude" = 20540 GhcDiagnosticCode "TcRnMissingMain" = 67120 |