diff options
author | Apoorv Ingle <apoorv-ingle@uiowa.edu> | 2023-02-06 09:13:10 -0600 |
---|---|---|
committer | sheaf <sam.derbyshire@gmail.com> | 2023-03-06 23:26:12 +0000 |
commit | c6432eacdac8e8fd135e52b2fb51bcb43b6913c3 (patch) | |
tree | 7e828ea71d138b4b94695e76250da93a22e94711 /compiler/GHC/Core | |
parent | cad5c5760f6fe06057eb7ad9927b9c1e83417c1e (diff) | |
download | haskell-c6432eacdac8e8fd135e52b2fb51bcb43b6913c3.tar.gz |
Constraint simplification loop now depends on `ExpansionFuel`
instead of a boolean flag for `CDictCan.cc_pend_sc`.
Pending givens get a fuel of 3 while Wanted and quantified constraints get a fuel of 1.
This helps pending given constraints to keep up with pending wanted constraints in case of
`UndecidableSuperClasses` and superclass expansions while simplifying the infered type.
Adds 3 dynamic flags for controlling the fuels for each type of constraints
`-fgivens-expansion-fuel` for givens `-fwanteds-expansion-fuel` for wanteds and `-fqcs-expansion-fuel` for quantified constraints
Fixes #21909
Added Tests T21909, T21909b
Added Note [Expanding Recursive Superclasses and ExpansionFuel]
Diffstat (limited to 'compiler/GHC/Core')
-rw-r--r-- | compiler/GHC/Core/Class.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/GHC/Core/Class.hs b/compiler/GHC/Core/Class.hs index 9ad470e9da..1b46f66fca 100644 --- a/compiler/GHC/Core/Class.hs +++ b/compiler/GHC/Core/Class.hs @@ -17,8 +17,8 @@ module GHC.Core.Class ( mkClass, mkAbstractClass, classTyVars, classArity, classKey, className, classATs, classATItems, classTyCon, classMethods, classOpItems, classBigSig, classExtraBigSig, classTvsFds, classSCTheta, - classAllSelIds, classSCSelId, classSCSelIds, classMinimalDef, classHasFds, - isAbstractClass, + classHasSCs, classAllSelIds, classSCSelId, classSCSelIds, classMinimalDef, + classHasFds, isAbstractClass, ) where import GHC.Prelude @@ -295,6 +295,9 @@ classSCTheta (Class { classBody = ConcreteClass { cls_sc_theta = theta_stuff }}) = theta_stuff classSCTheta _ = [] +classHasSCs :: Class -> Bool +classHasSCs cls = not (null (classSCTheta cls)) + classTvsFds :: Class -> ([TyVar], [FunDep TyVar]) classTvsFds c = (classTyVars c, classFunDeps c) |