diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-07-17 12:43:45 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-07-30 07:12:16 -0400 |
commit | d47324ce49b0c4f419823cbd7fd47e134a1b255a (patch) | |
tree | 015da0d155c1241cde370bf339ac7547a4d92fc0 /testsuite/tests/rename | |
parent | 01c948eba4bea2d2c8ad340e12c1e7b732b334f7 (diff) | |
download | haskell-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/rename')
-rw-r--r-- | testsuite/tests/rename/should_fail/T16002.stderr | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/testsuite/tests/rename/should_fail/T16002.stderr b/testsuite/tests/rename/should_fail/T16002.stderr index 98db6f99b6..91279ffeeb 100644 --- a/testsuite/tests/rename/should_fail/T16002.stderr +++ b/testsuite/tests/rename/should_fail/T16002.stderr @@ -1,6 +1,6 @@ T16002.hs:6:3: error: - Mismatched type name in type family instance. - Expected: B - Actual: A - In the declaration for type family ‘B’ + • Mismatched type name in type family instance. + Expected: B + Actual: A + • In the type family declaration for ‘B’ |