summaryrefslogtreecommitdiff
path: root/testsuite/tests/dependent
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-07-05 16:15:01 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-06 03:45:28 -0500
commite07e383a3250cb27a9128ad8d5c68def5c3df336 (patch)
treeb580fd84319138a3508303356318ac9b78750009 /testsuite/tests/dependent
parent2125b1d6bea0c620e3a089603dace6bb38020c81 (diff)
downloadhaskell-e07e383a3250cb27a9128ad8d5c68def5c3df336.tar.gz
Replace HsImplicitBndrs with HsOuterTyVarBndrs
This refactors the GHC AST to remove `HsImplicitBndrs` and replace it with `HsOuterTyVarBndrs`, a type which records whether the outermost quantification in a type is explicit (i.e., with an outermost, invisible `forall`) or implicit. As a result of this refactoring, it is now evident in the AST where the `forall`-or-nothing rule applies: it's all the places that use `HsOuterTyVarBndrs`. See the revamped `Note [forall-or-nothing rule]` in `GHC.Hs.Type` (previously in `GHC.Rename.HsType`). Moreover, the places where `ScopedTypeVariables` brings lexically scoped type variables into scope are a subset of the places that adhere to the `forall`-or-nothing rule, so this also makes places that interact with `ScopedTypeVariables` easier to find. See the revamped `Note [Lexically scoped type variables]` in `GHC.Hs.Type` (previously in `GHC.Tc.Gen.Sig`). `HsOuterTyVarBndrs` are used in type signatures (see `HsOuterSigTyVarBndrs`) and type family equations (see `HsOuterFamEqnTyVarBndrs`). The main difference between the former and the latter is that the former cares about specificity but the latter does not. There are a number of knock-on consequences: * There is now a dedicated `HsSigType` type, which is the combination of `HsOuterSigTyVarBndrs` and `HsType`. `LHsSigType` is now an alias for an `XRec` of `HsSigType`. * Working out the details led us to a substantial refactoring of the handling of explicit (user-written) and implicit type-variable bindings in `GHC.Tc.Gen.HsType`. Instead of a confusing family of higher order functions, we now have a local data type, `SkolemInfo`, that controls how these binders are kind-checked. It remains very fiddly, not fully satisfying. But it's better than it was. Fixes #16762. Bumps the Haddock submodule. Co-authored-by: Simon Peyton Jones <simonpj@microsoft.com> Co-authored-by: Richard Eisenberg <rae@richarde.dev> Co-authored-by: Zubin Duggal <zubin@cmi.ac.in>
Diffstat (limited to 'testsuite/tests/dependent')
-rw-r--r--testsuite/tests/dependent/should_fail/BadTelescope5.stderr7
-rw-r--r--testsuite/tests/dependent/should_fail/T14066.stderr2
-rw-r--r--testsuite/tests/dependent/should_fail/TypeSkolEscape.stderr2
3 files changed, 5 insertions, 6 deletions
diff --git a/testsuite/tests/dependent/should_fail/BadTelescope5.stderr b/testsuite/tests/dependent/should_fail/BadTelescope5.stderr
index d2ec36e5df..02daf9d742 100644
--- a/testsuite/tests/dependent/should_fail/BadTelescope5.stderr
+++ b/testsuite/tests/dependent/should_fail/BadTelescope5.stderr
@@ -2,10 +2,9 @@
BadTelescope5.hs:10:81: error:
• Expected kind ‘k’, but ‘d’ has kind ‘Proxy a’
‘k’ is a rigid type variable bound by
- ‘forall a k (b :: k) (c :: Proxy b) (d :: Proxy a).
- Proxy c -> SameKind b d’
+ an explicit forall a k (b :: k) (c :: Proxy b) (d :: Proxy a)
at BadTelescope5.hs:10:17
• In the second argument of ‘SameKind’, namely ‘d’
In the type signature:
- bar :: forall a k (b :: k) (c :: Proxy b) (d :: Proxy a).
- Proxy c -> SameKind b d
+ bar :: forall a k (b :: k) (c :: Proxy b) (d :: Proxy a). Proxy c
+ -> SameKind b d
diff --git a/testsuite/tests/dependent/should_fail/T14066.stderr b/testsuite/tests/dependent/should_fail/T14066.stderr
index d958f9a519..240108c296 100644
--- a/testsuite/tests/dependent/should_fail/T14066.stderr
+++ b/testsuite/tests/dependent/should_fail/T14066.stderr
@@ -3,7 +3,7 @@ T14066.hs:15:59: error:
• Expected kind ‘k0’, but ‘b’ has kind ‘k’
because kind variable ‘k’ would escape its scope
This (rigid, skolem) kind variable is bound by
- ‘forall k (b :: k). SameKind a b’
+ an explicit forall k (b :: k)
at T14066.hs:15:29-59
• In the second argument of ‘SameKind’, namely ‘b’
In the type signature: g :: forall k (b :: k). SameKind a b
diff --git a/testsuite/tests/dependent/should_fail/TypeSkolEscape.stderr b/testsuite/tests/dependent/should_fail/TypeSkolEscape.stderr
index a919095337..d642d6201c 100644
--- a/testsuite/tests/dependent/should_fail/TypeSkolEscape.stderr
+++ b/testsuite/tests/dependent/should_fail/TypeSkolEscape.stderr
@@ -3,7 +3,7 @@ TypeSkolEscape.hs:9:52: error:
• Expected kind ‘k0’, but ‘a’ has kind ‘TYPE v’
because kind variable ‘v’ would escape its scope
This (rigid, skolem) kind variable is bound by
- ‘forall (v :: RuntimeRep) (a :: TYPE v). a’
+ an explicit forall (v :: RuntimeRep) (a :: TYPE v)
at TypeSkolEscape.hs:9:12-52
• In the type ‘forall (v :: RuntimeRep) (a :: TYPE v). a’
In the type declaration for ‘Bad’