Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Spurious unused value warning with destructive substitution #7852
Original bug ID: 7852
This regression was introduced by #1737
I'll try to fix it without having to revert the GPR.
Steps to reproduce
Comment author: @trefis
This was reverted in #2092
FTR, what was happening is basically this:
Usage of items in OCaml is tracked by their name (i.e. the string, not the ident) and a Location.
Once we're done with the typing (we're now in Compile_common.typecheck_intf), we call "ignore (Includemod.signatures info.env sg sg)". Which has the effect of marking every item in the signature as used (which makes sense for mlis).
The issue is that we're doing that by going over the signature, taking the name + location of every item, and then using that to look in the table in Env. But the location we have is the new one, not the initial one which was used to add the items to the table. So we never mark the items that were initially added.
referenced this issue
Mar 15, 2019
I wrote a prototype for that based on 4.07 last week (because at the time it's still wasn't easy to test 4.08 / trunk on actual code) which I plan to rebase onto trunk (and submit a PR) next week.