Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[toc] [petanque] Definition shadowing makes API hard to use. #880

Open
ejgallego opened this issue Dec 5, 2024 · 3 comments
Open

[toc] [petanque] Definition shadowing makes API hard to use. #880

ejgallego opened this issue Dec 5, 2024 · 3 comments
Labels
kind: bug Something isn't working

Comments

@ejgallego
Copy link
Owner

ejgallego commented Dec 5, 2024

Originally reported by @gbdrt via mail.

In Flèche's TOC, we don't track scope of names, so in some cases shadowing happens. For example, in the following file:

Definition a := 3.

Section Bar.

Hypothesis (a : nat).

....

End Bar.

a in the section will shadow the first definition.

I wonder what the best remedy is here, other than the already planned fix for #332 , maybe we can hotfix this by qualifying hypothesis with their section name? (tho this results in some weird setup)

In general, Coq namespace semantics are a bit strange so it is not easy to mirror them easily in our TOC.

In general, I'm not sure how to make the naming in the start API fully reliable. We could allow for a document position, but that also has its own problems (how is the client going to resolve name to a position anyways)

cc #322

@ejgallego ejgallego added the kind: bug Something isn't working label Dec 5, 2024
@gbdrt
Copy link
Collaborator

gbdrt commented Dec 5, 2024

Somehow this is not visible in coq-lsp.
A file with a similar structure can be checked without errors.

@ejgallego
Copy link
Owner Author

Indeed, this is not really an error, but more like the map from names to locations we are using (toc for "table of contents") returns the latter location.

To solve this, we need to figure out a way to disambiguate that.

@ejgallego
Copy link
Owner Author

To fix the test for now I'd suggest renaming the hypothesis that is shadowing the lemma. But indeed, that's such a PITA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants