Description
This small patch fixes #16127, by following the recommendations outlined in #16127 (comment 496354).
Namely, in GHC.Tc.TyCl.checkValidTyCl
, we now do a call to a new function checkTyConConsistentWithBoot
, that attempts to find a matching definition in the boot info. If it does, it calls GHC.Tc.Module.checkBootDeclM
, which errors if the two declarations do not match. This patch also adds a test that replicates the original issue in typecheck/T16127
(based on my small repro case).
I have checked that this test failed against release/ghc-9.8
with the "expected" panic.
Open questions
This is my first patch against GHC, and i have in consequence a few questions:
- does
checkTyConConsistentWithBoot
match the naming convention? Should it be in snake case since it's not exported? -
checkTyConConsistentWithBoot
does not check whether we are currently compiling a boot file; i think that check isn't required, because if we are, then there will not be any boot info in theTcGblEnv
, is that correct? - would it be possible to now remove the call to
checkBootDeclM
inModule.checkHiBootIface'.check_export
, given that we should always have done that check by the time we reach that function? if it is possible: should we? or would it be better to leave the check as a precaution?