diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-11-30 17:05:11 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-01-29 02:41:21 -0500 |
commit | 268efcc9a45da36458442d9203c66a415b48f2b3 (patch) | |
tree | 8d99c80c3ebf68cd91c4262573a1a8634863f90a /testsuite/tests/th/T10946.stderr | |
parent | bb15c34784a3143ef048807fd351667d6775e399 (diff) | |
download | haskell-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/th/T10946.stderr')
-rw-r--r-- | testsuite/tests/th/T10946.stderr | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/th/T10946.stderr b/testsuite/tests/th/T10946.stderr new file mode 100644 index 0000000000..a5b6ebe16c --- /dev/null +++ b/testsuite/tests/th/T10946.stderr @@ -0,0 +1,14 @@ + +T10946.hs:8:13: error: + • Found hole: _ :: a + Where: ‘a’ is a rigid type variable bound by + the type signature for: + m :: forall a. a -> a + at T10946.hs:7:1-11 + • In the Template Haskell quotation [|| _ ||] + In the expression: [|| _ ||] + In the Template Haskell splice $$([|| _ ||]) + • Relevant bindings include + x :: a (bound at T10946.hs:8:3) + m :: a -> a (bound at T10946.hs:8:1) + Valid hole fits include x :: a (bound at T10946.hs:8:3) |