[Git][ghc/ghc][master] Add some structured diagnostics in Tc/Validity.hs

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Jul 3 07:29:53 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
03f941f4 by Ben Bellick at 2023-07-03T03:29:29-04:00
Add some structured diagnostics in Tc/Validity.hs

This addresses the work of ticket #20118
Created the following constructors for TcRnMessage
 - TcRnInaccessibleCoAxBranch
 - TcRnPatersonCondFailure

- - - - -


24 changed files:

- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Validity.hs
- compiler/GHC/Types/Error/Codes.hs
- testsuite/tests/dependent/should_compile/T14066a.stderr
- testsuite/tests/deriving/should_fail/T8165_fail2.stderr
- testsuite/tests/indexed-types/should_compile/T9085.stderr
- testsuite/tests/indexed-types/should_fail/NotRelaxedExamples.stderr
- testsuite/tests/indexed-types/should_fail/T10817.stderr
- testsuite/tests/indexed-types/should_fail/T15172.stderr
- testsuite/tests/indexed-types/should_fail/TyFamUndec.stderr
- testsuite/tests/quantified-constraints/T15231.stderr
- testsuite/tests/quantified-constraints/T15316.stderr
- testsuite/tests/typecheck/should_compile/T15473.stderr
- testsuite/tests/typecheck/should_compile/T6018.stderr
- testsuite/tests/typecheck/should_compile/tc265.stderr
- testsuite/tests/typecheck/should_fail/T15552a.stderr
- testsuite/tests/typecheck/should_fail/T19187a.stderr
- testsuite/tests/typecheck/should_fail/fd-loop.stderr
- testsuite/tests/typecheck/should_fail/tcfail108.stderr
- testsuite/tests/typecheck/should_fail/tcfail154.stderr
- testsuite/tests/typecheck/should_fail/tcfail157.stderr
- testsuite/tests/typecheck/should_fail/tcfail214.stderr


Changes:

=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -152,6 +152,10 @@ instance Diagnostic TcRnMessage where
          hang (text "Inaccessible code in")
            2 (ppr (ic_info implic))
          $$ pprSolverReportWithCtxt contra
+    TcRnInaccessibleCoAxBranch fam_tc cur_branch
+      -> mkSimpleDecorated $
+          text "Type family instance equation is overlapped:" $$
+          nest 2 (pprCoAxBranchUser fam_tc cur_branch)
     TcRnTypeDoesNotHaveFixedRuntimeRep ty prov (ErrInfo extra supplementary)
       -> mkDecorated [pprTypeDoesNotHaveFixedRuntimeRep ty prov, extra, supplementary]
     TcRnImplicitLift id_or_name ErrInfo{..}
@@ -1833,7 +1837,8 @@ instance Diagnostic TcRnMessage where
     TcRnIllegalQuasiQuotes -> mkSimpleDecorated $
       text "Quasi-quotes are not permitted without QuasiQuotes"
     TcRnTHError err -> pprTHError err
-
+    TcRnPatersonCondFailure reason ctxt lhs rhs ->
+      mkSimpleDecorated $ pprPatersonCondFailure reason ctxt lhs rhs
     TcRnIllegalInvisTyVarBndr bndr ->
       mkSimpleDecorated $
         hang (text "Illegal invisible type variable binder:")
@@ -1877,6 +1882,8 @@ instance Diagnostic TcRnMessage where
       -> WarningWithFlag Opt_WarnRedundantConstraints
     TcRnInaccessibleCode {}
       -> WarningWithFlag Opt_WarnInaccessibleCode
+    TcRnInaccessibleCoAxBranch {}
+      -> WarningWithFlag Opt_WarnInaccessibleCode
     TcRnTypeDoesNotHaveFixedRuntimeRep{}
       -> ErrorWithoutFlag
     TcRnImplicitLift{}
@@ -2485,6 +2492,8 @@ instance Diagnostic TcRnMessage where
       -> ErrorWithoutFlag
     TcRnImplicitRhsQuantification{}
       -> WarningWithFlag Opt_WarnImplicitRhsQuantification
+    TcRnPatersonCondFailure{}
+      -> ErrorWithoutFlag
 
   diagnosticHints = \case
     TcRnUnknownMessage m
@@ -2500,6 +2509,8 @@ instance Diagnostic TcRnMessage where
       -> noHints
     TcRnInaccessibleCode{}
       -> noHints
+    TcRnInaccessibleCoAxBranch{}
+      -> noHints
     TcRnTypeDoesNotHaveFixedRuntimeRep{}
       -> noHints
     TcRnImplicitLift{}
@@ -3154,6 +3165,8 @@ instance Diagnostic TcRnMessage where
       -> [SuggestAddStandaloneKindSignature name]
     TcRnImplicitRhsQuantification kv
       -> [SuggestBindTyVarOnLhs (unLoc kv)]
+    TcRnPatersonCondFailure{}
+      -> [suggestExtension LangExt.UndecidableInstances]
 
   diagnosticCode :: TcRnMessage -> Maybe DiagnosticCode
   diagnosticCode = constructorCode
@@ -6218,6 +6231,45 @@ addTopDeclsErrorHints = \case
   AddTopDeclsRunSpliceFailure {}
     -> noHints
 
+--------------------------------------------------------------------------------
+
+pprPatersonCondFailure ::
+  PatersonCondFailure -> PatersonCondFailureContext -> Type -> Type -> SDoc
+pprPatersonCondFailure (PCF_TyVar tvs) InInstanceDecl lhs rhs =
+  hang (occMsg tvs)
+    2 (sep [ text "in the constraint" <+> quotes (ppr lhs)
+         , text "than in the instance head" <+> quotes (ppr rhs) ])
+  where
+    occMsg tvs = text "Variable" <> plural tvs <+> quotes (pprWithCommas ppr tvs)
+                 <+> pp_occurs <+> text "more often"
+    pp_occurs | isSingleton tvs = text "occurs"
+              | otherwise       = text "occur"
+pprPatersonCondFailure (PCF_TyVar tvs) InTyFamEquation lhs rhs =
+  hang (occMsg tvs)
+    2 (sep [ text "in the type-family application" <+> quotes (ppr rhs)
+         , text "than in the LHS of the family instance" <+> quotes (ppr lhs) ])
+  where
+    occMsg tvs = text "Variable" <> plural tvs <+> quotes (pprWithCommas ppr tvs)
+                 <+> pp_occurs <+> text "more often"
+    pp_occurs | isSingleton tvs = text "occurs"
+              | otherwise       = text "occur"
+pprPatersonCondFailure PCF_Size InInstanceDecl lhs rhs =
+  hang (text "The constraint" <+> quotes (ppr lhs))
+    2 (sep [ text "is no smaller than", pp_rhs ])
+  where pp_rhs = text "the instance head" <+> quotes (ppr rhs)
+pprPatersonCondFailure PCF_Size InTyFamEquation lhs rhs =
+  hang (text "The type-family application" <+> quotes (ppr rhs))
+    2 (sep [ text "is no smaller than", pp_lhs ])
+  where pp_lhs = text "the LHS of the family instance" <+> quotes (ppr lhs)
+pprPatersonCondFailure  (PCF_TyFam tc) InInstanceDecl lhs _rhs =
+  hang (text "Illegal use of type family" <+> quotes (ppr tc))
+    2 (text "in the constraint" <+> quotes (ppr lhs))
+pprPatersonCondFailure  (PCF_TyFam tc) InTyFamEquation _lhs rhs =
+  hang (text "Illegal nested use of type family" <+> quotes (ppr tc))
+    2 (text "in the arguments of the type-family application" <+> quotes (ppr rhs))
+
+
+
 --------------------------------------------------------------------------------
 
 pprZonkerMessage :: ZonkerMessage -> SDoc


=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -167,7 +167,8 @@ import GHC.Tc.Types.Origin ( CtOrigin (ProvCtxtOrigin), SkolemInfoAnon (SigSkol)
                            , UserTypeCtxt (PatSynCtxt), TyVarBndrs, TypedThing
                            , FixedRuntimeRepOrigin(..), InstanceWhat )
 import GHC.Tc.Types.Rank (Rank)
-import GHC.Tc.Utils.TcType (TcType, TcSigmaType, TcPredType)
+import GHC.Tc.Utils.TcType (TcType, TcSigmaType, TcPredType,
+                            PatersonCondFailure, PatersonCondFailureContext)
 import GHC.Types.Basic
 import GHC.Types.Error
 import GHC.Types.Avail
@@ -364,7 +365,19 @@ data TcRnMessage where
   TcRnInaccessibleCode :: Implication          -- ^ The implication containing a contradiction.
                        -> SolverReportWithCtxt -- ^ The contradiction.
                        -> TcRnMessage
+  {-| TcRnInaccessibleCoAxBranch is a warning that is emitted when a closed type family has a
+      branch which is inaccessible due to a more general, prior branch.
 
+      Example:
+        type family F a where
+          F a = Int
+          F Bool = Bool
+      Test cases: T9085, T14066a, T9085, T6018, tc265,
+
+  -}
+  TcRnInaccessibleCoAxBranch :: TyCon      -- ^ The type family's constructor
+                             -> CoAxBranch -- ^ The inaccessible branch
+                             -> TcRnMessage
   {-| A type which was expected to have a fixed runtime representation
       does not have a fixed runtime representation.
 
@@ -4120,6 +4133,21 @@ data TcRnMessage where
 
   -}
   TcRnMissingRoleAnnotation :: Name -> [Role] -> TcRnMessage
+  {-| TcRnPatersonCondFailure is an error that occurs when an instance
+      declaration fails to conform to the Paterson conditions. Which particular condition
+      fails depends on the constructor of PatersonCondFailure
+      See Note [Paterson conditions].
+
+      Test cases:
+        T15231, tcfail157, T15316, T19187a, fd-loop, tcfail108, tcfail154,
+        T15172, tcfail214
+  -}
+  TcRnPatersonCondFailure
+    :: PatersonCondFailure -- ^ the failed Paterson Condition
+    -> PatersonCondFailureContext
+    -> Type                -- ^ the LHS
+    -> Type                -- ^ the RHS
+    -> TcRnMessage
 
   {-| TcRnImplicitRhsQuantification is a warning that occurs when GHC implicitly
       quantifies over a type variable that occurs free on the RHS of the type declaration


=====================================
compiler/GHC/Tc/Utils/TcType.hs
=====================================
@@ -117,7 +117,8 @@ module GHC.Tc.Utils.TcType (
 
   ---------------------------------
   -- Patersons sizes
-  PatersonSize(..), PatersonSizeFailure(..),
+  PatersonSize(..), PatersonCondFailure(..),
+  PatersonCondFailureContext(..),
   ltPatersonSize,
   pSizeZero, pSizeOne,
   pSizeType, pSizeTypeX, pSizeTypes,
@@ -2097,17 +2098,28 @@ The type-family termination test, in GHC.Tc.Validity.checkFamInstRhs, already
 has a separate call to isStuckTypeFamily, so the `F` above will still be accepted.
 -}
 
-
--- | Why was the LHS 'PatersonSize' not strictly smaller than the RHS 'PatersonSize'?
+-- | Why did the Paterson conditions fail; that is, why
+-- was the context P not Paterson-smaller than the head H?
 --
 -- See Note [Paterson conditions] in GHC.Tc.Validity.
-data PatersonSizeFailure
-  -- | Either side contains a type family.
-  = PSF_TyFam TyCon
-  -- | The size of the LHS is not strictly less than the size of the RHS.
-  | PSF_Size
-  -- | These type variables appear more often in the LHS than in the RHS.
-  | PSF_TyVar [TyVar] -- ^  no duplicates in this list
+data PatersonCondFailure
+  -- | Some type variables occur more often in P than in H.
+  -- See (PC1) in Note [Paterson conditions] in GHC.Tc.Validity.
+  = PCF_TyVar
+    [TyVar]  -- ^ the type variables which appear more often in the context
+  -- | P is not smaller in size than H.
+  -- See (PC2) in Note [Paterson conditions] in GHC.Tc.Validity.
+  | PCF_Size
+  -- | P contains a type family.
+  -- See (PC3) in Note [Paterson conditions] in GHC.Tc.Validity.
+  | PCF_TyFam
+    TyCon  -- ^ the type constructor of the type family
+
+-- | Indicates whether a Paterson condition failure occurred in an instance declaration or a type family equation.
+-- Useful for differentiating context in error messages.
+data PatersonCondFailureContext
+  = InInstanceDecl
+  | InTyFamEquation
 
 --------------------------------------
 
@@ -2119,7 +2131,6 @@ data PatersonSizeFailure
 data PatersonSize
   -- | The type mentions a type family, so the size could be anything.
   = PS_TyFam TyCon
-
   -- | The type does not mention a type family.
   | PS_Vanilla { ps_tvs :: [TyVar]  -- ^ free tyvars, including repetitions;
                , ps_size :: Int     -- ^ number of type constructors and variables
@@ -2142,14 +2153,14 @@ pSizeOne  = PS_Vanilla { ps_tvs = [], ps_size = 1 }
 --  - @Just ps_fail@ otherwise; @ps_fail@ says what went wrong.
 ltPatersonSize :: PatersonSize
                -> PatersonSize
-               -> Maybe PatersonSizeFailure
+               -> Maybe PatersonCondFailure
 ltPatersonSize (PS_Vanilla { ps_tvs = tvs1, ps_size = s1 })
                (PS_Vanilla { ps_tvs = tvs2, ps_size = s2 })
-  | s1 >= s2                                = Just PSF_Size
-  | bad_tvs@(_:_) <- noMoreTyVars tvs1 tvs2 = Just (PSF_TyVar bad_tvs)
+  | s1 >= s2                                = Just PCF_Size
+  | bad_tvs@(_:_) <- noMoreTyVars tvs1 tvs2 = Just (PCF_TyVar bad_tvs)
   | otherwise                               = Nothing -- OK!
-ltPatersonSize (PS_TyFam tc) _ = Just (PSF_TyFam tc)
-ltPatersonSize _ (PS_TyFam tc) = Just (PSF_TyFam tc)
+ltPatersonSize (PS_TyFam tc) _ = Just (PCF_TyFam tc)
+ltPatersonSize _ (PS_TyFam tc) = Just (PCF_TyFam tc)
   -- NB: this last equation is never taken when checking instances, because
   -- type families are disallowed in instance heads.
   --


=====================================
compiler/GHC/Tc/Validity.hs
=====================================
@@ -2049,40 +2049,9 @@ checkInstTermination theta head_pred
       where
         check2 pred_size
           = case pred_size `ltPatersonSize` head_size of
-              Just ps_failure -> failWithTc $ mkInstSizeError ps_failure head_pred pred
+              Just pc_failure -> failWithTc $ TcRnPatersonCondFailure pc_failure InInstanceDecl pred head_pred
               Nothing         -> return ()
 
-
-mkInstSizeError :: PatersonSizeFailure -> TcPredType -> TcPredType -> TcRnMessage
-mkInstSizeError ps_failure head_pred pred
-  = mkTcRnUnknownMessage $ mkPlainError noHints $
-    vcat [ main_msg
-         , parens undecidableMsg ]
-  where
-    pp_head = text "instance head" <+> quotes (ppr head_pred)
-    pp_pred = text "constraint" <+> quotes (ppr pred)
-
-    main_msg = case ps_failure of
-      PSF_TyFam tc -> -- See (PC3) of Note [Paterson conditions]
-                      hang (text "Illegal use of type family" <+> quotes (ppr tc))
-                         2 (text "in the" <+> pp_pred)
-      PSF_TyVar tvs -> hang (occMsg tvs)
-                          2 (sep [ text "in the" <+> pp_pred
-                                 , text "than in the" <+> pp_head ])
-      PSF_Size -> hang (text "The" <+> pp_pred)
-                     2 (sep [ text "is no smaller than", text "the" <+> pp_head ])
-
-occMsg :: [TyVar] -> SDoc
-occMsg tvs = text "Variable" <> plural tvs <+> quotes (pprWithCommas ppr tvs)
-                             <+> pp_occurs <+> text "more often"
-           where
-             pp_occurs | isSingleton tvs = text "occurs"
-                       | otherwise       = text "occur"
-
-undecidableMsg :: SDoc
-undecidableMsg = text "Use UndecidableInstances to permit this"
-
-
 {- Note [Instances and constraint synonyms]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Currently, we don't allow instances for constraint synonyms at all.
@@ -2137,8 +2106,7 @@ checkValidCoAxiom ax@(CoAxiom { co_ax_tc = fam_tc, co_ax_branches = branches })
     --   (b) failure of injectivity
     check_branch_compat prev_branches cur_branch
       | cur_branch `isDominatedBy` prev_branches
-      = do { let dia = mkTcRnUnknownMessage $
-                   mkPlainDiagnostic WarningWithoutFlag noHints (inaccessibleCoAxBranch fam_tc cur_branch)
+      = do { let dia = TcRnInaccessibleCoAxBranch fam_tc cur_branch
            ; addDiagnosticAt (coAxBranchSpan cur_branch) dia
            ; return prev_branches }
       | otherwise
@@ -2272,7 +2240,7 @@ checkValidAssocTyFamDeflt fam_tc pats =
       let dups = findDupsEq ((==) `on` fst) cpt_tvs_vis in
       traverse_
         (\d -> let (pat_tv, pat_vis) = NE.head d in failWithTc $
-              mkTcRnUnknownMessage $ mkPlainError noHints $
+               mkTcRnUnknownMessage $ mkPlainError noHints $
                pprWithExplicitKindsWhen (isInvisibleForAllTyFlag pat_vis) $
                hang (text "Illegal duplicate variable"
                        <+> quotes (ppr pat_tv) <+> text "in:")
@@ -2305,30 +2273,11 @@ checkFamInstRhs lhs_tc lhs_tys famInsts
    lhs_size = pSizeTypes lhs_tys
    check (tc, tys)
       | not (isStuckTypeFamily tc)                                   -- (TF1)
-      , Just ps_failure <- pSizeTypes tys `ltPatersonSize` lhs_size  -- (TF2)
-      = Just $ mkFamSizeError ps_failure (TyConApp lhs_tc lhs_tys) (TyConApp tc tys)
+      , Just pc_failure <- pSizeTypes tys `ltPatersonSize` lhs_size  -- (TF2)
+      = Just $ TcRnPatersonCondFailure pc_failure InTyFamEquation (TyConApp lhs_tc lhs_tys) (TyConApp tc tys)
       | otherwise
       = Nothing
 
-mkFamSizeError :: PatersonSizeFailure -> Type -> Type -> TcRnMessage
-mkFamSizeError ps_failure lhs fam_call
-  = mkTcRnUnknownMessage $ mkPlainError noHints $
-    vcat [ main_msg
-         , parens undecidableMsg ]
-  where
-    pp_lhs  = text "LHS of the family instance" <+> quotes (ppr lhs)
-    pp_call = text "type-family application" <+> quotes (ppr fam_call)
-
-    main_msg = case ps_failure of
-      PSF_TyFam tc -> -- See (PC3) of Note [Paterson conditions]
-                      hang (text "Illegal nested use of type family" <+> quotes (ppr tc))
-                         2 (text "in the arguments of the" <+> pp_call)
-      PSF_TyVar tvs -> hang (occMsg tvs)
-                          2 (sep [ text "in the" <+> pp_call
-                                 , text "than in the" <+> pp_lhs ])
-      PSF_Size -> hang (text "The" <+> pp_call)
-                     2 (sep [ text "is no smaller than", text "the" <+> pp_lhs ])
-
 -----------------
 checkFamPatBinders :: TyCon
                    -> [TcTyVar]   -- Bound on LHS of family instance
@@ -2425,13 +2374,6 @@ checkValidTypePats tc pat_ty_args
                 <+> quotes (ppr ty) <+> text "in instance" <> colon)
            2 (ppr inst_ty)
 
--- Error messages
-
-inaccessibleCoAxBranch :: TyCon -> CoAxBranch -> SDoc
-inaccessibleCoAxBranch fam_tc cur_branch
-  = text "Type family instance equation is overlapped:" $$
-    nest 2 (pprCoAxBranchUser fam_tc cur_branch)
-
 -------------------------
 checkConsistentFamInst :: AssocInstInfo
                        -> TyCon     -- ^ Family tycon


=====================================
compiler/GHC/Types/Error/Codes.hs
=====================================
@@ -332,6 +332,7 @@ type family GhcDiagnosticCode c = n | n -> c where
   -- Typechecker/renamer diagnostic codes
   GhcDiagnosticCode "TcRnRedundantConstraints"                      = 30606
   GhcDiagnosticCode "TcRnInaccessibleCode"                          = 40564
+  GhcDiagnosticCode "TcRnInaccessibleCoAxBranch"                    = 28129
   GhcDiagnosticCode "TcRnTypeDoesNotHaveFixedRuntimeRep"            = 18478
   GhcDiagnosticCode "TcRnImplicitLift"                              = 00846
   GhcDiagnosticCode "TcRnUnusedPatternBinds"                        = 61367
@@ -593,6 +594,7 @@ type family GhcDiagnosticCode c = n | n -> c where
   GhcDiagnosticCode "TcRnSimplifiableConstraint"                    = 62412
   GhcDiagnosticCode "TcRnIllegalQuasiQuotes"                        = 77343
   GhcDiagnosticCode "TcRnImplicitRhsQuantification"                 = 16382
+  GhcDiagnosticCode "TcRnPatersonCondFailure"                       = 22979
 
   -- TcRnTypeApplicationsDisabled
   GhcDiagnosticCode "TypeApplication"                               = 23482


=====================================
testsuite/tests/dependent/should_compile/T14066a.stderr
=====================================
@@ -1,5 +1,5 @@
 
-T14066a.hs:14:3: warning:
+T14066a.hs:14:3: warning: [GHC-28129] [-Winaccessible-code (in -Wdefault)]
     Type family instance equation is overlapped:
       forall {c} {x :: c} {d} {y :: d}.
         Bar x y = Bool -- Defined at T14066a.hs:14:3


=====================================
testsuite/tests/deriving/should_fail/T8165_fail2.stderr
=====================================
@@ -1,6 +1,6 @@
 
-T8165_fail2.hs:9:12: error:
+T8165_fail2.hs:9:12: error: [GHC-22979]
     • The type-family application ‘T Loop’
         is no smaller than the LHS of the family instance ‘T Loop’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘C Loop’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/indexed-types/should_compile/T9085.stderr
=====================================
@@ -1,4 +1,4 @@
 
-T9085.hs:7:3: Warning:
+T9085.hs:7:3: warning: [GHC-28129] [-Winaccessible-code (in -Wdefault)]
     Type family instance equation is overlapped:
       F Bool = Bool -- Defined at T9085.hs:7:3


=====================================
testsuite/tests/indexed-types/should_fail/NotRelaxedExamples.stderr
=====================================
@@ -1,18 +1,18 @@
 
-NotRelaxedExamples.hs:9:15: error:
+NotRelaxedExamples.hs:9:15: error: [GHC-22979]
     • Illegal nested use of type family ‘F1’
         in the arguments of the type-family application ‘F1 (F1 Char)’
-      (Use UndecidableInstances to permit this)
     • In the type instance declaration for ‘F1’
+    Suggested fix: Perhaps you intended to use UndecidableInstances
 
-NotRelaxedExamples.hs:10:15: error:
+NotRelaxedExamples.hs:10:15: error: [GHC-22979]
     • The type-family application ‘F2 [x]’
         is no smaller than the LHS of the family instance ‘F2 [x]’
-      (Use UndecidableInstances to permit this)
     • In the type instance declaration for ‘F2’
+    Suggested fix: Perhaps you intended to use UndecidableInstances
 
-NotRelaxedExamples.hs:11:15: error:
+NotRelaxedExamples.hs:11:15: error: [GHC-22979]
     • The type-family application ‘F3 [Char]’
         is no smaller than the LHS of the family instance ‘F3 Bool’
-      (Use UndecidableInstances to permit this)
     • In the type instance declaration for ‘F3’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/indexed-types/should_fail/T10817.stderr
=====================================
@@ -1,7 +1,7 @@
 
-T10817.hs:9:3: error:
+T10817.hs:9:3: error: [GHC-22979]
     • The type-family application ‘F a’
         is no smaller than the LHS of the family instance ‘F a’
-      (Use UndecidableInstances to permit this)
     • In the default type instance declaration for ‘F’
       In the class declaration for ‘C’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/indexed-types/should_fail/T15172.stderr
=====================================
@@ -1,5 +1,5 @@
 
-T15172.hs:11:10: error:
+T15172.hs:11:10: error: [GHC-22979]
     • Illegal use of type family ‘F’ in the constraint ‘F a’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘C [[a]]’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/indexed-types/should_fail/TyFamUndec.stderr
=====================================
@@ -1,19 +1,19 @@
 
-TyFamUndec.hs:6:15: error:
+TyFamUndec.hs:6:15: error: [GHC-22979]
     • Variable ‘b’ occurs more often
         in the type-family application ‘T (b, b)’
         than in the LHS of the family instance ‘T (a, [b])’
-      (Use UndecidableInstances to permit this)
     • In the type instance declaration for ‘T’
+    Suggested fix: Perhaps you intended to use UndecidableInstances
 
-TyFamUndec.hs:7:15: error:
+TyFamUndec.hs:7:15: error: [GHC-22979]
     • The type-family application ‘T (a, Maybe b)’
         is no smaller than the LHS of the family instance ‘T (a, Maybe b)’
-      (Use UndecidableInstances to permit this)
     • In the type instance declaration for ‘T’
+    Suggested fix: Perhaps you intended to use UndecidableInstances
 
-TyFamUndec.hs:8:15: error:
+TyFamUndec.hs:8:15: error: [GHC-22979]
     • Illegal nested use of type family ‘T’
         in the arguments of the type-family application ‘T (a, T b)’
-      (Use UndecidableInstances to permit this)
     • In the type instance declaration for ‘T’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/quantified-constraints/T15231.stderr
=====================================
@@ -1,7 +1,7 @@
 
-T15231.hs:15:10: error:
+T15231.hs:15:10: error: [GHC-22979]
     • Variable ‘c’ occurs more often
         in the constraint ‘c’ than in the instance head ‘Z a’
-      (Use UndecidableInstances to permit this)
     • In the quantified constraint ‘c => Z a’
       In the instance declaration for ‘Z (ECC c a)’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/quantified-constraints/T15316.stderr
=====================================
@@ -1,6 +1,6 @@
 
-T15316.hs:20:13: error:
+T15316.hs:20:13: error: [GHC-22979]
     • The constraint ‘c’ is no smaller than the instance head ‘c’
-      (Use UndecidableInstances to permit this)
     • In the quantified constraint ‘c => c’
       In the type signature: subsume' :: Proxy c -> ((c => c) => r) -> r
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_compile/T15473.stderr
=====================================
@@ -1,9 +1,9 @@
 
-T15473.hs:11:3: error:
+T15473.hs:11:3: error: [GHC-22979]
     • Variable ‘a’ occurs more often
         in the type-family application ‘Undefined’
         than in the LHS of the family instance ‘LetInterleave
                                                   xs t ts is y z’
-      (Use UndecidableInstances to permit this)
     • In the equations for closed type family ‘LetInterleave’
       In the type family declaration for ‘LetInterleave’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_compile/T6018.stderr
=====================================
@@ -2,10 +2,10 @@
 [2 of 3] Compiling T6018a           ( T6018a.hs, T6018a.o )
 [3 of 3] Compiling T6018            ( T6018.hs, T6018.o )
 
-T6018.hs:109:5: warning:
+T6018.hs:109:5: warning: [GHC-28129] [-Winaccessible-code (in -Wdefault)]
     Type family instance equation is overlapped:
       Foo Bool = Bool -- Defined at T6018.hs:109:5
 
-T6018.hs:116:5: warning:
+T6018.hs:116:5: warning: [GHC-28129] [-Winaccessible-code (in -Wdefault)]
     Type family instance equation is overlapped:
       Bar Bool = Char -- Defined at T6018.hs:116:5


=====================================
testsuite/tests/typecheck/should_compile/tc265.stderr
=====================================
@@ -1,4 +1,4 @@
 
-tc265.hs:8:3: warning:
+tc265.hs:8:3: warning: [GHC-28129] [-Winaccessible-code (in -Wdefault)]
     Type family instance equation is overlapped:
       F (T Int) = Bool -- Defined at tc265.hs:8:3


=====================================
testsuite/tests/typecheck/should_fail/T15552a.stderr
=====================================
@@ -1,24 +1,24 @@
 
-T15552a.hs:26:9: error:
+T15552a.hs:26:9: error: [GHC-22979]
     • Illegal nested use of type family ‘FirstEntryOfVal’
         in the arguments of the type-family application ‘GetEntryOfVal
                                                            (FirstEntryOfVal v kvs)’
-      (Use UndecidableInstances to permit this)
     • In the equations for closed type family ‘FirstEntryOfVal’
       In the type family declaration for ‘FirstEntryOfVal’
+    Suggested fix: Perhaps you intended to use UndecidableInstances
 
-T15552a.hs:26:9: error:
+T15552a.hs:26:9: error: [GHC-22979]
     • Illegal nested use of type family ‘FirstEntryOfVal’
         in the arguments of the type-family application ‘EntryOfValKey
                                                            (FirstEntryOfVal v kvs)’
-      (Use UndecidableInstances to permit this)
     • In the equations for closed type family ‘FirstEntryOfVal’
       In the type family declaration for ‘FirstEntryOfVal’
+    Suggested fix: Perhaps you intended to use UndecidableInstances
 
-T15552a.hs:26:9: error:
+T15552a.hs:26:9: error: [GHC-22979]
     • Illegal nested use of type family ‘FirstEntryOfVal’
         in the arguments of the type-family application ‘EntryOfValKey
                                                            (FirstEntryOfVal v kvs)’
-      (Use UndecidableInstances to permit this)
     • In the equations for closed type family ‘FirstEntryOfVal’
       In the type family declaration for ‘FirstEntryOfVal’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_fail/T19187a.stderr
=====================================
@@ -1,6 +1,6 @@
 
-T19187a.hs:7:10: error:
+T19187a.hs:7:10: error: [GHC-22979]
     • The constraint ‘Eq Int’
         is no smaller than the instance head ‘Eq T’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘Eq T’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_fail/fd-loop.stderr
=====================================
@@ -1,6 +1,6 @@
 
-fd-loop.hs:12:10: error:
+fd-loop.hs:12:10: error: [GHC-22979]
     • The constraint ‘C a b’
         is no smaller than the instance head ‘Eq (T a)’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘Eq (T a)’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_fail/tcfail108.stderr
=====================================
@@ -1,6 +1,6 @@
 
-tcfail108.hs:7:10: error:
+tcfail108.hs:7:10: error: [GHC-22979]
     • The constraint ‘Eq (f (Rec f))’
         is no smaller than the instance head ‘Eq (Rec f)’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘Eq (Rec f)’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_fail/tcfail154.stderr
=====================================
@@ -1,6 +1,6 @@
 
-tcfail154.hs:13:10: error:
+tcfail154.hs:13:10: error: [GHC-22979]
     • The constraint ‘C a a’
         is no smaller than the instance head ‘Eq (T a)’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘Eq (T a)’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_fail/tcfail157.stderr
=====================================
@@ -1,7 +1,7 @@
 
-tcfail157.hs:27:10: error:
+tcfail157.hs:27:10: error: [GHC-22979]
     • Variable ‘b’ occurs more often
         in the constraint ‘E m a b’
         than in the instance head ‘Foo m (a -> ())’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘Foo m (a -> ())’
+    Suggested fix: Perhaps you intended to use UndecidableInstances


=====================================
testsuite/tests/typecheck/should_fail/tcfail214.stderr
=====================================
@@ -1,5 +1,5 @@
 
-tcfail214.hs:9:10: error:
+tcfail214.hs:9:10: error: [GHC-22979]
     • Illegal use of type family ‘F’ in the constraint ‘F a’
-      (Use UndecidableInstances to permit this)
     • In the instance declaration for ‘C [a]’
+    Suggested fix: Perhaps you intended to use UndecidableInstances



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/03f941f45607a5ee52ca53a358333bbb41ddb1bc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/03f941f45607a5ee52ca53a358333bbb41ddb1bc
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230703/10c0c1c3/attachment-0001.html>


More information about the ghc-commits mailing list