diff options
author | Richard Eisenberg <rae@richarde.dev> | 2019-06-07 16:53:11 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-19 09:04:03 -0400 |
commit | d9c6b86e922ef786411b852bd247ef5573ee7a59 (patch) | |
tree | e866b8781e9898ab30941a91c6b3b1c4ae4e2a17 /testsuite/tests/partial-sigs | |
parent | de1723b260a60bcecc4271c5ac3c60b590bf257f (diff) | |
download | haskell-d9c6b86e922ef786411b852bd247ef5573ee7a59.tar.gz |
Refactor kindGeneralize and friends
This commit should have no change in behavior.(*)
The observation was that Note [Recipe for checking a signature]
says that every metavariable in a type-checked type must either
(A) be generalized
(B) be promoted
(C) be zapped.
Yet the code paths for doing these were all somewhat separate.
This led to some steps being skipped. This commit shores this
all up. The key innovation is TcHsType.kindGeneralizeSome, with
appropriate commentary.
This commit also sets the stage for #15809, by turning the
WARNing about bad level-numbers in generalisation into an
ASSERTion. The actual fix for #15809 will be in a separate
commit.
Other changes:
* zonkPromoteType is now replaced by kindGeneralizeNone.
This might have a small performance degradation, because
zonkPromoteType zonked and promoted all at once. The new
code path promotes first, and then zonks.
* A call to kindGeneralizeNone was added in tcHsPartialSigType.
I think this was a lurking bug, because it did not follow
Note [Recipe for checking a signature]. I did not try to
come up with an example showing the bug. This is the (*)
above.
Because of this change, there is an error message regression
in partial-sigs/should_fail/T14040a. This problem isn't really
a direct result of this refactoring, but is a symptom of
something deeper. See #16775, which addresses the deeper
problem.
* I added a short-cut to quantifyTyVars, in case there's
nothing to quantify.
* There was a horribly-outdated Note that wasn't referred
to. Gone now.
* While poking around with T14040a, I discovered a small
mistake in the Coercion.simplifyArgsWorker. Easy to fix,
happily.
* See new Note [Free vars in coercion hole] in TcMType.
Previously, we were doing the wrong thing when looking
at a coercion hole in the gather-candidates algorithm.
Fixed now, with lengthy explanation.
Metric Decrease:
T14683
Diffstat (limited to 'testsuite/tests/partial-sigs')
-rw-r--r-- | testsuite/tests/partial-sigs/should_fail/T14040a.stderr | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/testsuite/tests/partial-sigs/should_fail/T14040a.stderr b/testsuite/tests/partial-sigs/should_fail/T14040a.stderr index 24782235ba..31e5c8c4e7 100644 --- a/testsuite/tests/partial-sigs/should_fail/T14040a.stderr +++ b/testsuite/tests/partial-sigs/should_fail/T14040a.stderr @@ -1,10 +1,13 @@ T14040a.hs:34:8: error: - • Cannot apply expression of type ‘Sing wl - -> (forall y. p _2 'WeirdNil) - -> (forall z1 (x :: z1) (xs :: WeirdList (WeirdList z1)). - Sing x -> Sing xs -> p _0 xs -> p _1 ('WeirdCons x xs)) - -> p _2 wl’ + • Cannot apply expression of type ‘Sing wl0 + -> (forall y. p0 _0 'WeirdNil) + -> (forall z (x :: z) (xs :: WeirdList (WeirdList z)). + Sing x + -> Sing xs + -> p0 GHC.Types.Any xs + -> p0 GHC.Types.Any ('WeirdCons x xs)) + -> p0 GHC.Types.Any wl0’ to a visible type argument ‘(WeirdList z)’ • In the sixth argument of ‘pWeirdCons’, namely ‘(elimWeirdList @(WeirdList z) @xs @p xs pWeirdNil pWeirdCons)’ |