summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-05-31 07:32:11 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2020-06-05 14:21:24 -0400
commit2dff814158e08aed53036bf6ebd7c3c8394af438 (patch)
treeaec2283d5e4e36e51ac03e8654dda40f3dc0b66e /testsuite/tests
parent2b792facab46f7cdd09d12e79499f4e0dcd4293f (diff)
downloadhaskell-2dff814158e08aed53036bf6ebd7c3c8394af438.tar.gz
Simplify bindLHsTyVarBndrs and bindHsQTyVarswip/simply-bind-tyvars
Both `bindLHsTyVarBndrs` and `bindHsQTyVars` take two separate `Maybe` arguments, which I find terribly confusing. Thankfully, it's possible to remove one `Maybe` argument from each of these functions, which this patch accomplishes: * `bindHsQTyVars` takes a `Maybe SDoc` argument, which is `Just` if GHC should warn about any of the quantified type variables going unused. However, every call site uses `Nothing` in practice. This makes sense, since it doesn't really make sense to warn about unused type variables bound by an `LHsQTyVars`. For instance, you wouldn't warn about the `a` in `data Proxy a = Proxy` going unused. As a result, I simply remove this `Maybe SDoc` argument altogether. * `bindLHsTyVarBndrs` also takes a `Maybe SDoc` argument for the same reasons that `bindHsQTyVars` took one. To make things more confusing, however, `bindLHsTyVarBndrs` also takes a separate `HsDocContext` argument, which is pretty-printed (to an `SDoc`) in warnings and error messages. In practice, the `Maybe SDoc` and the `HsDocContext` often contain the same text. See the call sites for `bindLHsTyVarBndrs` in `rnFamInstEqn` and `rnConDecl`, for instance. There are only a handful of call sites where the text differs between the `Maybe SDoc` and `HsDocContext` arguments: * In `rnHsRuleDecl`, where the `Maybe SDoc` says "`In the rule`" and the `HsDocContext` says "`In the transformation rule`". * In `rnHsTyKi`/`rn_ty`, where the `Maybe SDoc` says "`In the type`" but the `HsDocContext` is inhereted from the surrounding context (e.g., if `rnHsTyKi` were called on a top-level type signature, the `HsDocContext` would be "`In the type signature`" instead) In both cases, warnings/error messages arguably _improve_ by unifying making the `Maybe SDoc`'s text match that of the `HsDocContext`. As a result, I decided to remove the `Maybe SDoc` argument to `bindLHsTyVarBndrs` entirely and simply reuse the text from the `HsDocContext`. (I decided to change the phrase "transformation rule" to "rewrite rule" while I was in the area.) The `Maybe SDoc` argument has one other purpose: signaling when to emit "`Unused quantified type variable`" warnings. To recover this functionality, I replaced the `Maybe SDoc` argument with a boolean-like `WarnUnusedForalls` argument. The only `bindLHsTyVarBndrs` call site that chooses _not_ to emit these warnings in `bindHsQTyVars`.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/dependent/should_fail/T16326_Fail10.stderr2
-rw-r--r--testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr2
-rw-r--r--testsuite/tests/rename/should_compile/T5331.stderr2
-rw-r--r--testsuite/tests/safeHaskell/ghci/p14.stderr8
-rw-r--r--testsuite/tests/typecheck/should_compile/T10072.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T5853.stderr2
6 files changed, 9 insertions, 9 deletions
diff --git a/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr b/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr
index 4ef380e5ba..44a0d34a33 100644
--- a/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr
+++ b/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr
@@ -4,4 +4,4 @@ T16326_Fail10.hs:12:18: error:
forall a -> a -> a
(GHC does not yet support this)
• In the type signature for ‘x’: forall a -> a -> a
- When checking the transformation rule "flurmp"
+ When checking the rewrite rule "flurmp"
diff --git a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr
index 0a575c9bb3..5852074450 100644
--- a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr
+++ b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr
@@ -1,4 +1,4 @@
ExplicitForAllRules1.hs:49:31: warning: [-Wunused-foralls (in -Wextra)]
Unused quantified type variable ‘b’
- in the rule "example7"
+ In the rewrite rule "example7"
diff --git a/testsuite/tests/rename/should_compile/T5331.stderr b/testsuite/tests/rename/should_compile/T5331.stderr
index fb27e64af1..d57daceb0a 100644
--- a/testsuite/tests/rename/should_compile/T5331.stderr
+++ b/testsuite/tests/rename/should_compile/T5331.stderr
@@ -9,4 +9,4 @@ T5331.hs:11:16: warning: [-Wunused-foralls (in -Wextra)]
T5331.hs:13:13: warning: [-Wunused-foralls (in -Wextra)]
Unused quantified type variable ‘a’
- In the type ‘forall a. Int’
+ In the type signature for ‘f’
diff --git a/testsuite/tests/safeHaskell/ghci/p14.stderr b/testsuite/tests/safeHaskell/ghci/p14.stderr
index 65baafe716..736e8b448c 100644
--- a/testsuite/tests/safeHaskell/ghci/p14.stderr
+++ b/testsuite/tests/safeHaskell/ghci/p14.stderr
@@ -1,6 +1,6 @@
<interactive>:9:25: error:
- No instance for (Num a) arising from a use of ‘f’
- Possible fix: add (Num a) to the context of the RULE "id/Int"
- In the expression: f
- When checking the transformation rule "id/Int"
+ • No instance for (Num a) arising from a use of ‘f’
+ Possible fix: add (Num a) to the context of the RULE "id/Int"
+ • In the expression: f
+ When checking the rewrite rule "id/Int"
diff --git a/testsuite/tests/typecheck/should_compile/T10072.stderr b/testsuite/tests/typecheck/should_compile/T10072.stderr
index 71a93c9573..994a03f903 100644
--- a/testsuite/tests/typecheck/should_compile/T10072.stderr
+++ b/testsuite/tests/typecheck/should_compile/T10072.stderr
@@ -7,4 +7,4 @@ T10072.hs:3:31: error:
To use the inferred type, enable PartialTypeSignatures
• In the type ‘a -> _’
In the type signature for ‘f’: a -> _
- When checking the transformation rule "map/empty"
+ When checking the rewrite rule "map/empty"
diff --git a/testsuite/tests/typecheck/should_fail/T5853.stderr b/testsuite/tests/typecheck/should_fail/T5853.stderr
index 6fd62bb79b..5d42625796 100644
--- a/testsuite/tests/typecheck/should_fail/T5853.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5853.stderr
@@ -9,7 +9,7 @@ T5853.hs:15:52: error:
bound by the RULE "map/map" at T5853.hs:15:2-57
NB: ‘Subst’ is a non-injective type family
• In the expression: (f . g) <$> xs
- When checking the transformation rule "map/map"
+ When checking the rewrite rule "map/map"
• Relevant bindings include
f :: Elem fa -> b (bound at T5853.hs:15:19)
g :: a -> Elem fa (bound at T5853.hs:15:21)