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

Parsing no longer seems to use vos files #1000

Closed
tchajed opened this issue Jan 20, 2025 · 16 comments · Fixed by #1020
Closed

Parsing no longer seems to use vos files #1000

tchajed opened this issue Jan 20, 2025 · 16 comments · Fixed by #1020
Labels
bug Something isn't working

Comments

@tchajed
Copy link

tchajed commented Jan 20, 2025

I believe this used to work so it's a recent regression.

If you clone https://github.com/tchajed/sys-verif-fa24-proofs, run git submodule update --init --recursive and make vos, then open in VS Code (you can ignore the dev container prompt) and try opening src/sys_verif/program_proof/demos/hashmap_proof.v it gives a bunch of parsing errors. Stepping through the file at this point is also very broken.

Sorry I don't have a more minimal example. However, this whole repo is also a good stress test of VsCoq.

@gares
Copy link
Member

gares commented Jan 20, 2025

The only change that comes to mind is that now vscoq loads the _CoqProject closer to source files, while before id only loaded the same _CoqProject at the root of the repo. Do you happen to have multiple (and possibly broken) _CoqProject files?

@tchajed
Copy link
Author

tchajed commented Jan 20, 2025

Yes, we have _CoqProject files for dependencies that are in submodules. They aren't broken but are insufficient. Only the top-level file should be used, in the root of the repository, and it has all the configuration needed for the dependencies.

@rtetley
Copy link
Collaborator

rtetley commented Jan 20, 2025

In fact I checked earlier and it is the root file _CoqProject that seems to be loaded. I'll check tomorrow to see if the arguments are correct.

@gares
Copy link
Member

gares commented Jan 20, 2025

@rtetley only Coq master has support for loading different _CoqProject, I guess @tchajed is using that right?

@gares
Copy link
Member

gares commented Jan 20, 2025

Only the top-level file should be used

This is not what CoqIDE does.
Is PG loading the root one only?

Also, are you building with dune? (If so, support for that would solve your issue since we would ask dune the "right" flags)

@tchajed
Copy link
Author

tchajed commented Jan 20, 2025

I am not using Coq master, 8.20 is working.
Proof General works and has always worked with this setup.
I'm not using dune or even coq_makefile, it's a custom setup only using coqdep + make (very similar to Perennial).

@SkySkimmer
Copy link
Contributor

@rtetley only Coq master has support for loading different _CoqProject, I guess @tchajed is using that right?

No, IIRC only the vscoq server version matters for this (but on older Coq more settings may be carried over from the root project file)

@SkySkimmer
Copy link
Contributor

However I don't think this is an issue about opening the wrong coqproject as https://github.com/tchajed/sys-verif-fa24-proofs/tree/main/src/sys_verif/program_proof/demos does not seem to have any _CoqProject files between it and the root.

@gares
Copy link
Member

gares commented Jan 20, 2025

No, IIRC only the vscoq server version matters for this (but on older Coq more settings may be carried over from the root project file)

No, it is the second time I got his by this:

[%%if coq = "8.18" || coq = "8.19" || coq = "8.20"]
(* in these coq versions init_runtime called globally for the process includes init_document
this means in these versions we do not support local _CoqProject except for the effect on injections
(eg -noinit) *)
let init_document _ vst = vst
[%%else]
let init_document local_args vst =
let () = Vernacstate.unfreeze_full_state vst in
let () = Coqinit.init_document local_args in
Vernacstate.freeze_full_state ()
[%%endif]

But anyway, as you noticed, there is no other _CoqProject so it is loading the root one, so my diagnoses is wrong.

@SkySkimmer
Copy link
Contributor

Ah only the injections are taken from the local coqproject in older coq

@rtetley rtetley added the bug Something isn't working label Jan 24, 2025
@SkySkimmer
Copy link
Contributor

SkySkimmer commented Jan 29, 2025

It seems vscoq just doesn't set Flags.load_vos_libraries
I don't think this is a recent change but coqidetop does set it so vscoq legacy used it

@gares
Copy link
Member

gares commented Jan 29, 2025

Thanks gaetan, this is likely to be the culprit.

@rtetley
Copy link
Collaborator

rtetley commented Jan 30, 2025

So after working on #1020, I noticed that setting the flag works, but only if you open the root folder in vscode (the one containing the _CoqProject). If you open the file from a folder that is higher in the file hierarchy, the _CoqProject still seems to load (form the logs) but we go back to the errors mentioned above (namely Cannot find a physical path bound to logical path, which leads to all the parse errors). Is this expected ?

@rtetley
Copy link
Collaborator

rtetley commented Jan 30, 2025

Since this is a one line fix (disregarding the behaviour discussed above) I will include it in the next release.

@rtetley rtetley added this to the Next release (v2.2.4) milestone Jan 30, 2025
@SkySkimmer
Copy link
Contributor

So after working on #1020, I noticed that setting the flag works, but only if you open the root folder in vscode (the one containing the _CoqProject). If you open the file from a folder that is higher in the file hierarchy, the _CoqProject still seems to load (form the logs) but we go back to the errors mentioned above (namely Cannot find a physical path bound to logical path, which leads to all the parse errors). Is this expected ?

Do you get the error only if you did make vos or also if you did regular make?

@rtetley
Copy link
Collaborator

rtetley commented Jan 30, 2025

Well disregard my previous comment, it seems to work actually. Idk what I messed up in my earlier tests.

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

Successfully merging a pull request may close this issue.

4 participants