summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-11-30 17:05:11 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-29 02:41:21 -0500
commit268efcc9a45da36458442d9203c66a415b48f2b3 (patch)
tree8d99c80c3ebf68cd91c4262573a1a8634863f90a /testsuite/tests/deriving
parentbb15c34784a3143ef048807fd351667d6775e399 (diff)
downloadhaskell-268efcc9a45da36458442d9203c66a415b48f2b3.tar.gz
Rework the handling of SkolemInfo
The main purpose of this patch is to attach a SkolemInfo directly to each SkolemTv. This fixes the large number of bugs which have accumulated over the years where we failed to report errors due to having "no skolem info" for particular type variables. Now the origin of each type varible is stored on the type variable we can always report accurately where it cames from. Fixes #20969 #20732 #20680 #19482 #20232 #19752 #10946 #19760 #20063 #13499 #14040 The main changes of this patch are: * SkolemTv now contains a SkolemInfo field which tells us how the SkolemTv was created. Used when reporting errors. * Enforce invariants relating the SkolemInfoAnon and level of an implication (ic_info, ic_tclvl) to the SkolemInfo and level of the type variables in ic_skols. * All ic_skols are TcTyVars -- Check is currently disabled * All ic_skols are SkolemTv * The tv_lvl of the ic_skols agrees with the ic_tclvl * The ic_info agrees with the SkolInfo of the implication. These invariants are checked by a debug compiler by checkImplicationInvariants. * Completely refactor kcCheckDeclHeader_sig which kept doing my head in. Plus, it wasn't right because it wasn't skolemising the binders as it decomposed the kind signature. The new story is described in Note [kcCheckDeclHeader_sig]. The code is considerably shorter than before (roughly 240 lines turns into 150 lines). It still has the same awkward complexity around computing arity as before, but that is a language design issue. See Note [Arity inference in kcCheckDeclHeader_sig] * I added new type synonyms MonoTcTyCon and PolyTcTyCon, and used them to be clear which TcTyCons have "finished" kinds etc, and which are monomorphic. See Note [TcTyCon, MonoTcTyCon, and PolyTcTyCon] * I renamed etaExpandAlgTyCon to splitTyConKind, becuase that's a better name, and it is very useful in kcCheckDeclHeader_sig, where eta-expansion isn't an issue. * Kill off the nasty `ClassScopedTvEnv` entirely. Co-authored-by: Simon Peyton Jones <simon.peytonjones@gmail.com>
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r--testsuite/tests/deriving/should_compile/T14579.stderr20
1 files changed, 8 insertions, 12 deletions
diff --git a/testsuite/tests/deriving/should_compile/T14579.stderr b/testsuite/tests/deriving/should_compile/T14579.stderr
index 31545c6de7..7ba5c6a2f0 100644
--- a/testsuite/tests/deriving/should_compile/T14579.stderr
+++ b/testsuite/tests/deriving/should_compile/T14579.stderr
@@ -22,22 +22,18 @@ Derived class instances:
instance forall a (x :: Data.Proxy.Proxy a).
GHC.Classes.Eq a =>
GHC.Classes.Eq (T14579.Wat x) where
- (GHC.Classes.==) ::
- T14579.Wat x[sk:1] -> T14579.Wat x[sk:1] -> GHC.Types.Bool
- (GHC.Classes./=) ::
- T14579.Wat x[sk:1] -> T14579.Wat x[sk:1] -> GHC.Types.Bool
+ (GHC.Classes.==) :: T14579.Wat x -> T14579.Wat x -> GHC.Types.Bool
+ (GHC.Classes./=) :: T14579.Wat x -> T14579.Wat x -> GHC.Types.Bool
(GHC.Classes.==)
= GHC.Prim.coerce
- @(GHC.Maybe.Maybe a[sk:1]
- -> GHC.Maybe.Maybe a[sk:1] -> GHC.Types.Bool)
- @(T14579.Wat x[sk:1] -> T14579.Wat x[sk:1] -> GHC.Types.Bool)
- ((GHC.Classes.==) @(GHC.Maybe.Maybe a[sk:1]))
+ @(GHC.Maybe.Maybe a -> GHC.Maybe.Maybe a -> GHC.Types.Bool)
+ @(T14579.Wat x -> T14579.Wat x -> GHC.Types.Bool)
+ ((GHC.Classes.==) @(GHC.Maybe.Maybe a))
(GHC.Classes./=)
= GHC.Prim.coerce
- @(GHC.Maybe.Maybe a[sk:1]
- -> GHC.Maybe.Maybe a[sk:1] -> GHC.Types.Bool)
- @(T14579.Wat x[sk:1] -> T14579.Wat x[sk:1] -> GHC.Types.Bool)
- ((GHC.Classes./=) @(GHC.Maybe.Maybe a[sk:1]))
+ @(GHC.Maybe.Maybe a -> GHC.Maybe.Maybe a -> GHC.Types.Bool)
+ @(T14579.Wat x -> T14579.Wat x -> GHC.Types.Bool)
+ ((GHC.Classes./=) @(GHC.Maybe.Maybe a))
Derived type family instances: