[Git][ghc/ghc][wip/no-warn-superclasses] Remove loopy superclass solve mechanism
Krzysztof Gogolewski (@monoidal)
gitlab at gitlab.haskell.org
Sat Nov 11 01:00:10 UTC 2023
Krzysztof Gogolewski pushed to branch wip/no-warn-superclasses at Glasgow Haskell Compiler / GHC
Commits:
06759f51 by Krzysztof Gogolewski at 2023-11-11T01:59:44+01:00
Remove loopy superclass solve mechanism
Programs with a -Wloopy-superclass-solve warning will now fail with an error.
Fixes #23017
- - - - -
26 changed files:
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Origin.hs-boot
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Hint.hs
- compiler/GHC/Types/Hint/Ppr.hs
- docs/users_guide/using-warnings.rst
- − testsuite/tests/typecheck/should_compile/T20666b.stderr
- − testsuite/tests/typecheck/should_compile/T22891.stderr
- − testsuite/tests/typecheck/should_compile/T22912.stderr
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T20666.stderr
- testsuite/tests/typecheck/should_fail/T20666a.stderr
- testsuite/tests/typecheck/should_compile/T20666b.hs → testsuite/tests/typecheck/should_fail/T20666b.hs
- + testsuite/tests/typecheck/should_fail/T20666b.stderr
- testsuite/tests/typecheck/should_compile/T22891.hs → testsuite/tests/typecheck/should_fail/T22891.hs
- + testsuite/tests/typecheck/should_fail/T22891.stderr
- testsuite/tests/typecheck/should_compile/T22912.hs → testsuite/tests/typecheck/should_fail/T22912.hs
- + testsuite/tests/typecheck/should_fail/T22912.stderr
- testsuite/tests/typecheck/should_fail/T6161.stderr
- testsuite/tests/typecheck/should_fail/all.T
- testsuite/tests/typecheck/should_fail/tcfail223.stderr
Changes:
=====================================
compiler/GHC/Driver/Flags.hs
=====================================
@@ -688,7 +688,7 @@ data WarningFlag =
| Opt_WarnGADTMonoLocalBinds -- Since 9.4
| Opt_WarnTypeEqualityOutOfScope -- Since 9.4
| Opt_WarnTypeEqualityRequiresOperators -- Since 9.4
- | Opt_WarnLoopySuperclassSolve -- Since 9.6
+ | Opt_WarnLoopySuperclassSolve -- Since 9.6, has no effect since 9.10
| Opt_WarnTermVariableCapture -- Since 9.8
| Opt_WarnMissingRoleAnnotations -- Since 9.8
| Opt_WarnImplicitRhsQuantification -- Since 9.8
@@ -948,7 +948,6 @@ standardWarnings -- see Note [Documenting warning flags]
Opt_WarnForallIdentifier,
Opt_WarnUnicodeBidirectionalFormatCharacters,
Opt_WarnGADTMonoLocalBinds,
- Opt_WarnLoopySuperclassSolve,
Opt_WarnBadlyStagedTypes,
Opt_WarnTypeEqualityRequiresOperators,
Opt_WarnInconsistentFlags,
=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -2198,7 +2198,7 @@ wWarningFlagsDeps = [minBound..maxBound] >>= \x -> case x of
Opt_WarnInconsistentFlags -> warnSpec x
Opt_WarnInlineRuleShadowing -> warnSpec x
Opt_WarnIdentities -> warnSpec x
- Opt_WarnLoopySuperclassSolve -> warnSpec x
+ Opt_WarnLoopySuperclassSolve -> depWarnSpec x "it is now an error"
Opt_WarnMissingFields -> warnSpec x
Opt_WarnMissingImportList -> warnSpec x
Opt_WarnMissingExportList -> warnSpec x
=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -1349,18 +1349,6 @@ instance Diagnostic TcRnMessage where
, text "Combine alternative minimal complete definitions with `|'" ]
where
sigs = sig1 : sig2 : otherSigs
- TcRnLoopySuperclassSolve wtd_loc wtd_pty ->
- mkSimpleDecorated $ vcat [ header, warning, user_manual ]
- where
- header, warning, user_manual :: SDoc
- header
- = vcat [ text "I am solving the constraint" <+> quotes (ppr wtd_pty) <> comma
- , nest 2 $ pprCtOrigin (ctLocOrigin wtd_loc) <> comma
- , text "in a way that might turn out to loop at runtime." ]
- warning
- = vcat [ text "Starting from GHC 9.10, this warning will turn into an error." ]
- user_manual =
- vcat [ text "See the user manual, § Undecidable instances and loopy superclasses." ]
TcRnUnexpectedStandaloneDerivingDecl -> mkSimpleDecorated $
text "Illegal standalone deriving declaration"
TcRnUnusedVariableInRuleDecl name var -> mkSimpleDecorated $
@@ -2311,8 +2299,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnDuplicateMinimalSig{}
-> ErrorWithoutFlag
- TcRnLoopySuperclassSolve{}
- -> WarningWithFlag Opt_WarnLoopySuperclassSolve
TcRnUnexpectedStandaloneDerivingDecl{}
-> ErrorWithoutFlag
TcRnUnusedVariableInRuleDecl{}
@@ -2962,13 +2948,6 @@ instance Diagnostic TcRnMessage where
-> [suggestExtension LangExt.DefaultSignatures]
TcRnDuplicateMinimalSig{}
-> noHints
- TcRnLoopySuperclassSolve wtd_loc wtd_pty
- -> [LoopySuperclassSolveHint wtd_pty cls_or_qc]
- where
- cls_or_qc :: ClsInstOrQC
- cls_or_qc = case ctLocOrigin wtd_loc of
- ScOrigin c_or_q _ -> c_or_q
- _ -> IsClsInst -- shouldn't happen
TcRnUnexpectedStandaloneDerivingDecl{}
-> [suggestExtension LangExt.StandaloneDeriving]
TcRnUnusedVariableInRuleDecl{}
=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -3134,23 +3134,6 @@ data TcRnMessage where
TcRnDeprecatedInvisTyArgInConPat
:: TcRnMessage
- {-| TcRnLoopySuperclassSolve is a warning, controlled by @-Wloopy-superclass-solve@,
- that is triggered when GHC solves a constraint in a possibly-loopy way,
- violating the class instance termination rules described in the section
- "Undecidable instances and loopy superclasses" of the user's guide.
-
- Example:
-
- class Foo f
- class Foo f => Bar f g
- instance Bar f f => Bar f (h k)
-
- Test cases: T20666, T20666{a,b}, T22891, T22912.
- -}
- TcRnLoopySuperclassSolve :: CtLoc -- ^ Wanted 'CtLoc'
- -> PredType -- ^ Wanted 'PredType'
- -> TcRnMessage
-
{-| TcRnUnexpectedStandaloneDerivingDecl is an error thrown when a user uses
standalone deriving without enabling the StandaloneDeriving extension.
=====================================
compiler/GHC/Tc/Solver/Dict.hs
=====================================
@@ -98,7 +98,6 @@ solveDict dict_ct@(DictCt { di_ev = ev, di_cls = cls, di_tys = tys })
; doTopFunDepImprovement dict_ct
- ; tryLastResortProhibitedSuperClass dict_ct
; simpleStage (updInertDicts dict_ct)
; stopWithStage (dictCtEvidence dict_ct) "Kept inert DictCt" }
@@ -1367,38 +1366,6 @@ with the least superclass depth (see Note [Replacement vs keeping]),
but that doesn't work for the example from #22216.
-}
-{- *******************************************************************
-* *
- Last resort prohibited superclass
-* *
-**********************************************************************-}
-
-tryLastResortProhibitedSuperClass :: DictCt -> SolverStage ()
--- ^ As a last resort, we TEMPORARILY allow a prohibited superclass solve,
--- emitting a loud warning when doing so: we might be creating non-terminating
--- evidence (as we are in T22912 for example).
---
--- See Note [Migrating away from loopy superclass solving] in GHC.Tc.TyCl.Instance.
-tryLastResortProhibitedSuperClass dict_ct
- = Stage $ do { inerts <- getInertCans
- ; last_resort inerts dict_ct }
-
-last_resort :: InertCans -> DictCt -> TcS (StopOrContinue ())
-last_resort inerts (DictCt { di_ev = ev_w, di_cls = cls, di_tys = xis })
- | let loc_w = ctEvLoc ev_w
- orig_w = ctLocOrigin loc_w
- , ScOrigin _ NakedSc <- orig_w -- work_item is definitely Wanted
- , Just ct_i <- lookupInertDict inerts loc_w cls xis
- , let ev_i = dictCtEvidence ct_i
- , isGiven ev_i
- = do { setEvBindIfWanted ev_w True (ctEvTerm ev_i)
- ; ctLocWarnTcS loc_w $
- TcRnLoopySuperclassSolve loc_w (ctEvPred ev_w)
- ; return $ Stop ev_w (text "Loopy superclass") }
- | otherwise
- = continueWith ()
-
-
{- *********************************************************************
* *
* Functional dependencies, instantiation of equations
=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -1696,20 +1696,6 @@ Answer:
superclass selection, except at a smaller type. This test is
implemented by GHC.Tc.Solver.InertSet.prohibitedSuperClassSolve
-Note [Migrating away from loopy superclass solving]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The logic from Note [Solving superclass constraints] was implemented in GHC 9.6.
-However, we want to provide a migration strategy for users, to avoid suddenly
-breaking their code going when upgrading to GHC 9.6. To this effect, we temporarily
-continue to allow the constraint solver to create these potentially non-terminating
-solutions, but emit a loud warning when doing so: see
-GHC.Tc.Solver.Dict.tryLastResortProhibitedSuperclass.
-
-Users can silence the warning by manually adding the necessary constraint to the
-context. GHC will then keep this user-written Given, dropping the Given arising
-from superclass expansion which has greater SC depth, as explained in
-Note [Replacement vs keeping] in GHC.Tc.Solver.Dict.
-
Note [Silent superclass arguments] (historical interest only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NB1: this note describes our *old* solution to the
=====================================
compiler/GHC/Tc/Types/Origin.hs-boot
=====================================
@@ -16,8 +16,4 @@ data FixedRuntimeRepOrigin
mkFRRUnboxedTuple :: Int -> FixedRuntimeRepContext
mkFRRUnboxedSum :: Maybe Int -> FixedRuntimeRepContext
-data CtOrigin
-data ClsInstOrQC = IsClsInst
- | IsQC CtOrigin
-
unkSkol :: HasCallStack => SkolemInfo
=====================================
compiler/GHC/Types/Error/Codes.hs
=====================================
@@ -520,7 +520,7 @@ type family GhcDiagnosticCode c = n | n -> c where
GhcDiagnosticCode "TcRnMisplacedSigDecl" = 87866
GhcDiagnosticCode "TcRnUnexpectedDefaultSig" = 40700
GhcDiagnosticCode "TcRnDuplicateMinimalSig" = 85346
- GhcDiagnosticCode "TcRnLoopySuperclassSolve" = 36038
+ GhcDiagnosticCode "TcRnLoopySuperclassSolve" = Outdated 36038
GhcDiagnosticCode "TcRnUnexpectedStandaloneDerivingDecl" = 95159
GhcDiagnosticCode "TcRnUnusedVariableInRuleDecl" = 65669
GhcDiagnosticCode "TcRnUnexpectedStandaloneKindSig" = 45906
=====================================
compiler/GHC/Types/Hint.hs
=====================================
@@ -35,13 +35,12 @@ import GHC.Hs.Extension (GhcTc, GhcRn)
import GHC.Core.Coercion
import GHC.Core.FamInstEnv (FamFlavor)
import GHC.Core.TyCon (TyCon)
-import GHC.Core.Type (PredType, Type)
+import GHC.Core.Type (Type)
import GHC.Types.Fixity (LexicalFixity(..))
import GHC.Types.Name (Name, NameSpace, OccName (occNameFS), isSymOcc, nameOccName)
import GHC.Types.Name.Reader (RdrName (Unqual), ImpDeclSpec)
import GHC.Types.SrcLoc (SrcSpan)
import GHC.Types.Basic (Activation, RuleName)
-import {-# SOURCE #-} GHC.Tc.Types.Origin ( ClsInstOrQC(..) )
import GHC.Parser.Errors.Basic
import GHC.Utils.Outputable
import GHC.Data.FastString (fsLit, FastString)
@@ -433,8 +432,6 @@ data GhcHint
-}
| SuggestRenameTypeVariable
- | LoopySuperclassSolveHint PredType ClsInstOrQC
-
| SuggestExplicitBidiPatSyn Name (LPat GhcRn) [LIdP GhcRn]
{-| Suggest enabling one of the SafeHaskell modes Safe, Unsafe or
=====================================
compiler/GHC/Types/Hint/Ppr.hs
=====================================
@@ -16,7 +16,6 @@ import GHC.Core.FamInstEnv (FamFlavor(..))
import GHC.Core.TyCon
import GHC.Core.TyCo.Rep ( mkVisFunTyMany )
import GHC.Hs.Expr () -- instance Outputable
-import GHC.Tc.Types.Origin ( ClsInstOrQC(..) )
import GHC.Types.Id
import GHC.Types.Name
import GHC.Types.Name.Reader (RdrName,ImpDeclSpec (..), rdrNameOcc, rdrNameSpace)
@@ -217,14 +216,6 @@ instance Outputable GhcHint where
mod = nameModule name
SuggestRenameTypeVariable
-> text "Consider renaming the type variable."
- LoopySuperclassSolveHint pty cls_or_qc
- -> vcat [ text "Add the constraint" <+> quotes (ppr pty) <+> text "to the" <+> what <> comma
- , text "even though it seems logically implied by other constraints in the context." ]
- where
- what :: SDoc
- what = case cls_or_qc of
- IsClsInst -> text "instance context"
- IsQC {} -> text "context of the quantified constraint"
SuggestExplicitBidiPatSyn name pat args
-> hang (text "Instead use an explicitly bidirectional"
<+> text "pattern synonym, e.g.")
=====================================
docs/users_guide/using-warnings.rst
=====================================
@@ -2422,20 +2422,17 @@ of ``-W(no-)*``.
extension.
.. ghc-flag:: -Wloopy-superclass-solve
- :shortdesc: warn when creating potentially-loopy superclass constraint evidence
+ :shortdesc: *(deprecated)* warn when creating potentially-loopy superclass constraint evidence
:type: dynamic
:reverse: -Wno-loopy-superclass-solve
:since: 9.6.1
- As explained in :ref:`undecidable-instances`, when using
- :extension:`UndecidableInstances` it is possible for GHC to construct
+ This warning is deprecated. It no longer has any effect since GHC 9.10.
+ In the past, :extension:`UndecidableInstances` allowed potentially
non-terminating evidence for certain superclass constraints.
-
- This behaviour is scheduled to be removed in a future GHC version.
- In the meantime, GHC emits this warning to inform users of potential
- non-termination. Users can manually add the required constraint to the context
- to avoid the problem (thus silencing the warning).
+ This is no longer allowed, as explained in :ref:`undecidable-instances`.
+ This warning was used during the transition period.
.. ghc-flag:: -Wterm-variable-capture
:shortdesc: warn when an implicitly quantified type variable captures a term's name
=====================================
testsuite/tests/typecheck/should_compile/T20666b.stderr deleted
=====================================
@@ -1,10 +0,0 @@
-
-T20666b.hs:11:10: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Eq (F [a])’,
- arising from the superclasses of an instance declaration,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Eq (F [a])’ to the instance context,
- even though it seems logically implied by other constraints in the context.
=====================================
testsuite/tests/typecheck/should_compile/T22891.stderr deleted
=====================================
@@ -1,10 +0,0 @@
-
-T22891.hs:9:10: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Foo f’,
- arising from the superclasses of an instance declaration,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Foo f’ to the instance context,
- even though it seems logically implied by other constraints in the context.
=====================================
testsuite/tests/typecheck/should_compile/T22912.stderr deleted
=====================================
@@ -1,12 +0,0 @@
-
-T22912.hs:17:16: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Implies c’,
- arising from the head of a quantified constraint
- arising from a use of ‘go’,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Implies
- c’ to the context of the quantified constraint,
- even though it seems logically implied by other constraints in the context.
=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -866,9 +866,6 @@ test('T22647', normal, compile, [''])
test('T19577', normal, compile, [''])
test('T22383', normal, compile, [''])
test('T21501', normal, compile, [''])
-test('T20666b', normal, compile, [''])
-test('T22891', normal, compile, [''])
-test('T22912', normal, compile, [''])
test('T22924', normal, compile, [''])
test('T22985a', normal, compile, ['-O'])
test('T22985b', normal, compile, [''])
=====================================
testsuite/tests/typecheck/should_fail/T20666.stderr
=====================================
@@ -1,20 +1,20 @@
-T20666.hs:13:10: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Show (T c)’,
- arising from the superclasses of an instance declaration,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Show (T c)’ to the instance context,
- even though it seems logically implied by other constraints in the context.
+T20666.hs:13:10: error: [GHC-39999]
+ • Could not deduce ‘Show (T c)’
+ arising from the superclasses of an instance declaration
+ from the context: (D d, c ~ S d)
+ bound by the instance declaration at T20666.hs:13:10-31
+ Possible fix:
+ If the constraint looks soluble from a superclass of the instance context,
+ read 'Undecidable instances and loopy superclasses' in the user manual
+ • In the instance declaration for ‘C1 c’
-T20666.hs:17:10: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Show (T c)’,
- arising from the superclasses of an instance declaration,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Show (T c)’ to the instance context,
- even though it seems logically implied by other constraints in the context.
+T20666.hs:17:10: error: [GHC-39999]
+ • Could not deduce ‘Show (T c)’
+ arising from the superclasses of an instance declaration
+ from the context: (D d, c ~ S d, c' ~ c)
+ bound by the instance declaration at T20666.hs:17:10-40
+ Possible fix:
+ If the constraint looks soluble from a superclass of the instance context,
+ read 'Undecidable instances and loopy superclasses' in the user manual
+ • In the instance declaration for ‘C2 c'’
=====================================
testsuite/tests/typecheck/should_fail/T20666a.stderr
=====================================
@@ -1,10 +1,10 @@
-T20666a.hs:11:10: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Eq (F [a])’,
- arising from the superclasses of an instance declaration,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Eq (F [a])’ to the instance context,
- even though it seems logically implied by other constraints in the context.
+T20666a.hs:11:10: error: [GHC-39999]
+ • Could not deduce ‘Eq (F [a])’
+ arising from the superclasses of an instance declaration
+ from the context: D [a]
+ bound by the instance declaration at T20666a.hs:11:10-23
+ Possible fix:
+ If the constraint looks soluble from a superclass of the instance context,
+ read 'Undecidable instances and loopy superclasses' in the user manual
+ • In the instance declaration for ‘C [a]’
=====================================
testsuite/tests/typecheck/should_compile/T20666b.hs → testsuite/tests/typecheck/should_fail/T20666b.hs
=====================================
=====================================
testsuite/tests/typecheck/should_fail/T20666b.stderr
=====================================
@@ -0,0 +1,10 @@
+
+T20666b.hs:11:10: error: [GHC-39999]
+ • Could not deduce ‘Eq (F [a])’
+ arising from the superclasses of an instance declaration
+ from the context: D [a]
+ bound by the instance declaration at T20666b.hs:11:10-23
+ Possible fix:
+ If the constraint looks soluble from a superclass of the instance context,
+ read 'Undecidable instances and loopy superclasses' in the user manual
+ • In the instance declaration for ‘C [a]’
=====================================
testsuite/tests/typecheck/should_compile/T22891.hs → testsuite/tests/typecheck/should_fail/T22891.hs
=====================================
=====================================
testsuite/tests/typecheck/should_fail/T22891.stderr
=====================================
@@ -0,0 +1,9 @@
+
+T22891.hs:9:10: error: [GHC-39999]
+ • Could not deduce ‘Foo f’
+ arising from the superclasses of an instance declaration
+ from the context: Bar f f
+ bound by the instance declaration at T22891.hs:9:10-31
+ Possible fix:
+ add (Foo f) to the context of the instance declaration
+ • In the instance declaration for ‘Bar f (h k3)’
=====================================
testsuite/tests/typecheck/should_compile/T22912.hs → testsuite/tests/typecheck/should_fail/T22912.hs
=====================================
=====================================
testsuite/tests/typecheck/should_fail/T22912.stderr
=====================================
@@ -0,0 +1,20 @@
+
+T22912.hs:17:16: error: [GHC-39999]
+ • Could not deduce ‘Implies c’
+ arising from the head of a quantified constraint
+ arising from a use of ‘go’
+ from the context: Exactly (Implies c)
+ bound by a quantified context at T22912.hs:17:16-17
+ Possible fix:
+ add (Implies c) to the context of
+ the type signature for:
+ anythingDict :: forall (c :: Constraint). Dict c
+ or If the constraint looks soluble from a superclass of the instance context,
+ read 'Undecidable instances and loopy superclasses' in the user manual
+ • In the expression: go
+ In an equation for ‘anythingDict’:
+ anythingDict
+ = go
+ where
+ go :: (Exactly (Implies c) => Implies c) => Dict c
+ go = Dict
=====================================
testsuite/tests/typecheck/should_fail/T6161.stderr
=====================================
@@ -1,10 +1,7 @@
-T6161.hs:19:10: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Super (Fam a)’,
- arising from the superclasses of an instance declaration,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Super (Fam a)’ to the instance context,
- even though it seems logically implied by other constraints in the context.
+T6161.hs:19:10: error: [GHC-39999]
+ • Could not deduce ‘Super (Fam a)’
+ arising from the superclasses of an instance declaration
+ from the context: Foo a
+ bound by the instance declaration at T6161.hs:19:10-31
+ • In the instance declaration for ‘Duper (Fam a)’
=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -241,7 +241,7 @@ test('tcfail215', normal, compile_fail, [''])
test('tcfail216', normal, compile_fail, [''])
test('tcfail217', normal, compile_fail, [''])
test('tcfail218', normal, compile_fail, [''])
-test('tcfail223', normal, compile, ['']) # To become compile_fail after migration period (see #22912)
+test('tcfail223', normal, compile_fail, [''])
test('tcfail224', normal, compile_fail, [''])
test('tcfail225', normal, compile_fail, [''])
@@ -293,7 +293,7 @@ test('T19187a', normal, compile_fail, [''])
test('T2534', normal, compile_fail, [''])
test('T7175', normal, compile_fail, [''])
test('T7210', normal, compile_fail, [''])
-test('T6161', normal, compile, ['']) # To become compile_fail after migration period (see #22912)
+test('T6161', normal, compile_fail, [''])
test('T7368', normal, compile_fail, [''])
test('T7264', normal, compile_fail, [''])
test('T6069', normal, compile_fail, [''])
@@ -668,8 +668,11 @@ test('T21530a', normal, compile_fail, [''])
test('T21530b', normal, compile_fail, [''])
test('T22570', normal, compile_fail, [''])
test('T22645', normal, compile_fail, [''])
-test('T20666', normal, compile, ['']) # To become compile_fail after migration period (see #22912)
-test('T20666a', normal, compile, ['']) # To become compile_fail after migration period (see #22912)
+test('T20666', normal, compile_fail, [''])
+test('T20666a', normal, compile_fail, [''])
+test('T20666b', normal, compile_fail, [''])
+test('T22891', normal, compile_fail, [''])
+test('T22912', normal, compile_fail, [''])
test('T22924a', normal, compile_fail, [''])
test('T22924b', normal, compile_fail, [''])
test('T22940', normal, compile_fail, [''])
=====================================
testsuite/tests/typecheck/should_fail/tcfail223.stderr
=====================================
@@ -1,10 +1,9 @@
-tcfail223.hs:10:10: warning: [GHC-36038] [-Wloopy-superclass-solve (in -Wdefault)]
- I am solving the constraint ‘Class1 a’,
- arising from the superclasses of an instance declaration,
- in a way that might turn out to loop at runtime.
- Starting from GHC 9.10, this warning will turn into an error.
- See the user manual, § Undecidable instances and loopy superclasses.
- Suggested fix:
- Add the constraint ‘Class1 a’ to the instance context,
- even though it seems logically implied by other constraints in the context.
+tcfail223.hs:10:10: error: [GHC-39999]
+ • Could not deduce ‘Class1 a’
+ arising from the superclasses of an instance declaration
+ from the context: Class3 a
+ bound by the instance declaration at tcfail223.hs:10:10-29
+ Possible fix:
+ add (Class1 a) to the context of the instance declaration
+ • In the instance declaration for ‘Class2 a’
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/06759f514eb0bcfa401190e54bd69022b082bb96
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/06759f514eb0bcfa401190e54bd69022b082bb96
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/20231110/861b583a/attachment-0001.html>
More information about the ghc-commits
mailing list