summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-07-17 12:43:45 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-30 07:12:16 -0400
commitd47324ce49b0c4f419823cbd7fd47e134a1b255a (patch)
tree015da0d155c1241cde370bf339ac7547a4d92fc0 /testsuite/tests/indexed-types
parent01c948eba4bea2d2c8ad340e12c1e7b732b334f7 (diff)
downloadhaskell-d47324ce49b0c4f419823cbd7fd47e134a1b255a.tar.gz
Don't mark closed type family equations as occurrences
Previously, `rnFamInstEqn` would mark the name of the type/data family used in an equation as an occurrence, regardless of what sort of family it is. Most of the time, this is the correct thing to do. The exception is closed type families, whose equations constitute its definition and therefore should not be marked as occurrences. Overzealously counting the equations of a closed type family as occurrences can cause certain warnings to not be emitted, as observed in #18470. See `Note [Type family equations and occurrences]` in `GHC.Rename.Module` for the full story. This fixes #18470 with a little bit of extra-casing in `rnFamInstEqn`. To accomplish this, I added an extra `ClosedTyFamInfo` field to the `NonAssocTyFamEqn` constructor of `AssocTyFamInfo` and refactored the relevant call sites accordingly so that this information is propagated to `rnFamInstEqn`. While I was in town, I moved `wrongTyFamName`, which checks that the name of a closed type family matches the name in an equation for that family, from the renamer to the typechecker to avoid the need for an `ASSERT`. As an added bonus, this lets us simplify the details of `ClosedTyFamInfo` a bit.
Diffstat (limited to 'testsuite/tests/indexed-types')
-rw-r--r--testsuite/tests/indexed-types/should_fail/Overlap5.stderr8
1 files changed, 4 insertions, 4 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/Overlap5.stderr b/testsuite/tests/indexed-types/should_fail/Overlap5.stderr
index 512859753c..f67549104b 100644
--- a/testsuite/tests/indexed-types/should_fail/Overlap5.stderr
+++ b/testsuite/tests/indexed-types/should_fail/Overlap5.stderr
@@ -1,6 +1,6 @@
Overlap5.hs:8:3: error:
- Mismatched type name in type family instance.
- Expected: F
- Actual: G
- In the declaration for type family ‘F’
+ • Mismatched type name in type family instance.
+ Expected: F
+ Actual: G
+ • In the type family declaration for ‘F’