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

Coq 8.19 #702

Merged
merged 40 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
35e54a2
Test against Coq's master
maximedenes Aug 21, 2023
b57c98a
Fix Nix build
maximedenes Aug 21, 2023
a3b3956
Adapt to coq/coq#17928 (Search uses search_restriction instead of bool)
SkySkimmer Aug 9, 2023
6eda154
Merge pull request #564 from SkySkimmer/search-restr
maximedenes Aug 21, 2023
5ee2ad4
Adapt to Coq PR #17987 which adds sigma to the API of search functions
herbelin Aug 30, 2023
b0be276
Merge pull request #601 from herbelin/coq-master+adapt-coq-pr17987-se…
rtetley Sep 8, 2023
de88278
Adapt to Coq PR #18007: Proof_using.definition_using takes names of r…
herbelin Oct 8, 2023
4e6a855
Adapt to Coq PR #18007: Proof_using.definition_using takes names of r…
herbelin Oct 8, 2023
5f750ad
Adapt to https://github.com/coq/coq/pull/14928
proux01 Oct 9, 2023
d2b3249
Merge pull request #654 from herbelin/coq-master+adapt-coq-pr18007-ex…
SkySkimmer Oct 24, 2023
b3a7ed9
Adapt to coq/coq#18187 (reductionbehaviour is on constant not globref)
SkySkimmer Oct 24, 2023
e2ac4a9
Merge pull request #680 from SkySkimmer/redbehaviour-pred
SkySkimmer Oct 26, 2023
52e93f5
Adapt w.r.t. coq/coq#17136.
ppedrot Nov 6, 2023
fd291f5
Merge pull request #685 from ppedrot/stream_error_to_gramlib
ppedrot Nov 9, 2023
907bed4
Merge pull request #681 from coq-community/coq_14928
ppedrot Nov 10, 2023
a1aa8fe
Adapt w.r.t. coq/coq#18312.
ppedrot Nov 15, 2023
84032c7
Merge pull request #688 from ppedrot/detuplify-impargs
SkySkimmer Nov 16, 2023
d8a72d9
[wip] Merge branch 'coq-master' into coq-8.19
gares Dec 24, 2023
0dba89a
[ci] opam: test 8.18 and 8.19
gares Dec 24, 2023
215b5e1
[ppx_optcomp] define coq version
gares Dec 24, 2023
3e737ce
[wip] ifdef for 8.18
gares Dec 24, 2023
ca7733b
downgrade dune, there is an error with lang dune 3.5
gares Dec 24, 2023
1c3e1f2
Update .github/workflows/ci.yml
gares Dec 24, 2023
58a8df2
Update .github/workflows/ci.yml
gares Dec 24, 2023
9284071
Update language-server/build-windows-platform.bat
gares Dec 24, 2023
9c8a869
fixup ci
gares Dec 24, 2023
3a9f229
fix ci opam
gares Dec 24, 2023
466e732
progress
gares Dec 24, 2023
355e0dd
fix more code
gares Dec 25, 2023
f40ef29
more fix
gares Dec 25, 2023
e1e89f4
Update language-server/dm/executionManager.ml
gares Dec 29, 2023
c8f063f
Updating nix flakes
rtetley Jan 30, 2024
97d0fc5
Merge branch 'main' into coq-8.19
rtetley Jan 31, 2024
8878774
fixing deps. wip
rtetley Jan 31, 2024
4b986bf
Fixing nix.
rtetley Feb 2, 2024
9b99cb6
Nix build for different coq versions.
rtetley Feb 5, 2024
87dd6d0
Fix typo in flake
rtetley Feb 5, 2024
bf063d8
Fix flake + adapt to https://github.com/coq/coq/pull/18529
rtetley Feb 6, 2024
cd0d767
Update .github/workflows/ci.yml
rtetley Feb 6, 2024
bf48804
Update .github/workflows/ci.yml
gares Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
coq: [coq-8-18, coq-8-19, coq-master]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -41,7 +42,7 @@ jobs:
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix develop .#vscoq-language-server -c bash -c "cd language-server && dune build"
- run: nix develop .#vscoq-language-server-${{ matrix.coq }} -c bash -c "cd language-server && dune build"
- run: nix develop .#vscoq-client -c bash -c "cd client && yarn run install:all && yarn run build:all && yarn run compile"
- run: xvfb-run nix develop .#vscoq-client -c bash -c "cd client && yarn test"
if: runner.os == 'Linux'
Expand All @@ -52,9 +53,11 @@ jobs:

install-opam:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ocaml-compiler: [4.13.x]
coq: [8.18.0, 8.19+rc1, dev]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -70,6 +73,7 @@ jobs:
OPAMYES: true
run: |
opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev
opam install coq-core.${{ matrix.coq }}
opam pin add vscoq-language-server ./language-server/ --with-doc --with-test -y

- run: |
Expand Down
58 changes: 57 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 109 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,88 @@

flake-utils.url = "github:numtide/flake-utils";

coq-master = { url = "github:coq/coq/b157d65080076498ad04dd3918c1e508eb9740c0"; }; # Should be kept in sync with PIN_COQ in CI workflow
coq-master.inputs.nixpkgs.follows = "nixpkgs";

};

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, coq-master }:
flake-utils.lib.eachDefaultSystem (system:

let coq = coq-master.defaultPackage.${system}; in
rec {

packages.default = self.packages.${system}.vscoq-language-server;
packages.default = self.packages.${system}.vscoq-language-server-coq-8-19;

packages.vscoq-language-server-coq-8-18 =
# Notice the reference to nixpkgs here.
with import nixpkgs { inherit system; };
let ocamlPackages = ocaml-ng.ocamlPackages_4_14; in
ocamlPackages.buildDunePackage {
duneVersion = "3";
pname = "vscoq-language-server";
version = "2.0.3";
src = ./language-server;
buildInputs = [
coq_8_18
dune_3
] ++ (with coq.ocamlPackages; [
lablgtk3-sourceview3
glib
gnome.adwaita-icon-theme
wrapGAppsHook
ocaml
yojson
zarith
findlib
ppx_inline_test
ppx_assert
ppx_sexp_conv
ppx_deriving
ppx_optcomp
ppx_import
sexplib
ppx_yojson_conv
lsp
sel
]);
};

packages.vscoq-language-server-coq-8-19 =
# Notice the reference to nixpkgs here.
with import nixpkgs { inherit system; };
let ocamlPackages = ocaml-ng.ocamlPackages_4_14; in
ocamlPackages.buildDunePackage {
duneVersion = "3";
pname = "vscoq-language-server";
version = "2.0.3";
src = ./language-server;
buildInputs = [
coq_8_19
dune_3
] ++ (with coq.ocamlPackages; [
lablgtk3-sourceview3
glib
gnome.adwaita-icon-theme
wrapGAppsHook
ocaml
yojson
zarith
findlib
ppx_inline_test
ppx_assert
ppx_sexp_conv
ppx_deriving
ppx_optcomp
ppx_import
sexplib
ppx_yojson_conv
lsp
sel
]);
};

packages.vscoq-language-server =
packages.vscoq-language-server-coq-master =
# Notice the reference to nixpkgs here.
with import nixpkgs { inherit system; };
let ocamlPackages = ocaml-ng.ocamlPackages_4_14; in
Expand All @@ -39,6 +111,7 @@
ppx_assert
ppx_sexp_conv
ppx_deriving
ppx_optcomp
ppx_import
sexplib
ppx_yojson_conv
Expand All @@ -61,11 +134,42 @@

};

devShells.default =
devShells.vscoq-client =
with import nixpkgs { inherit system; };
mkShell {
buildInputs = self.packages.${system}.vscoq-client.buildInputs;
};

devShells.vscoq-language-server-coq-8-18 =
with import nixpkgs { inherit system; };
mkShell {
buildInputs =
self.packages.${system}.vscoq-language-server-coq-8-18.buildInputs;
};

devShells.vscoq-language-server-coq-8-19 =
with import nixpkgs { inherit system; };
mkShell {
buildInputs =
self.packages.${system}.vscoq-language-server-coq-8-19.buildInputs;
};

devShells.vscoq-language-server-coq-master =
with import nixpkgs { inherit system; };
let ocamlPackages = ocaml-ng.ocamlPackages_4_14; in
mkShell {
buildInputs =
self.packages.${system}.vscoq-language-server-coq-master.buildInputs
++ (with ocamlPackages; [
ocaml-lsp
]);
};

devShells.default =
with import nixpkgs { inherit system; };
mkShell {
buildInputs =
self.packages.${system}.vscoq-language-server.buildInputs
self.packages.${system}.vscoq-language-server-coq-8-19.buildInputs
++ (with ocamlPackages; [
ocaml-lsp
]);
Expand Down
9 changes: 7 additions & 2 deletions language-server/dm/completionSuggester.ml
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,18 @@ let get_completion_items env proof lemmas options =
log ("Ranking of lemmas failed: " ^ (Printexc.to_string e));
lemmas

[%%if coq = "8.18"]
let generic_search e s f = Search.generic_search e (fun r k e c -> f r k e s c)
[%%else]
let generic_search = Search.generic_search
[%%endif]
let get_lemmas sigma env =
let open CompletionItems in
let results = ref [] in
let display ref _kind env c =
let display ref _kind env sigma c =
results := mk_completion_item sigma ref env c :: results.contents;
in
Search.generic_search env display;
generic_search env sigma display;
results.contents

let get_completions options st =
Expand Down
10 changes: 8 additions & 2 deletions language-server/dm/document.ml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ let rec junk_sentence_end stream =
| [] -> ()
| _ -> Stream.junk () stream; junk_sentence_end stream

[%%if coq = "8.18"]
exception E = Stream.Error
[%%else]
exception E = Grammar.Error
[%%endif]

let rec parse_more synterp_state stream raw parsed errors =
let handle_parse_error start msg =
log @@ "handling parse error at " ^ string_of_int start;
Expand Down Expand Up @@ -290,7 +296,7 @@ let rec parse_more synterp_state stream raw parsed errors =
let loc = Loc.get_loc @@ info in
handle_parse_error start (loc, Pp.string_of_ppcmds @@ CErrors.iprint_no_report (e,info))
end
| exception (Stream.Error msg as exn) ->
| exception (E msg as exn) ->
let loc = Loc.get_loc @@ Exninfo.info exn in
junk_sentence_end stream;
handle_parse_error start (loc,msg)
Expand Down Expand Up @@ -388,4 +394,4 @@ module Internal = struct
sentence.start
sentence.stop

end
end
1 change: 1 addition & 0 deletions language-server/dm/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(name dm)
(public_name vscoq-language-server.dm)
(modules :standard \ vscoqtop_proof_worker vscoqtop_tactic_worker)
(preprocess (pps ppx_optcomp -- -cookie "ppx_optcomp.env=env ~coq:(Defined \"%{coq:version.major}.%{coq:version.minor}\")"))
(libraries base coq-core.sysinit coq-core.vernac coq-core.parsing lsp sel protocol language))

(executable
Expand Down
11 changes: 9 additions & 2 deletions language-server/dm/executionManager.ml
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,22 @@ let interp_ast ~doc_id ~state_id ~st ~error_recovery ast =
st, status, []

(* This adapts the Future API with our event model *)
[%%if coq = "8.18"]
let definition_using e s ~fixnames:_ ~using ~terms =
Proof_using.definition_using e s ~using ~terms
[%%else]
let definition_using = Proof_using.definition_using
[%%endif]
let interp_qed_delayed ~proof_using ~state_id ~st =
let lemmas = Option.get @@ st.Vernacstate.interp.lemmas in
let f proof =
let proof =
let env = Global.env () in
let sigma, _ = Declare.Proof.get_current_context proof in
let initial_goals pf = Proofview.initial_goals Proof.((data pf).entry) in
let terms = List.map (fun (_,_,x) -> x) (initial_goals (Declare.Proof.get proof)) in
let using = Proof_using.definition_using env sigma ~using:proof_using ~terms in
let names = Vernacstate.LemmaStack.get_all_proof_names lemmas in
let using = definition_using env sigma ~fixnames:names ~using:proof_using ~terms in
let vars = Environ.named_context env in
Names.Id.Set.iter (fun id ->
if not (List.exists Util.(Context.Named.Declaration.get_id %> Names.Id.equal id) vars) then
Expand All @@ -202,7 +210,6 @@ let interp_qed_delayed ~proof_using ~state_id ~st =
let f, assign = Future.create_delegate ~blocking:false ~name:"XX" fix_exn in
Declare.Proof.close_future_proof ~feedback_id:state_id proof f, assign
in
let lemmas = Option.get @@ st.Vernacstate.interp.lemmas in
let proof, assign = Vernacstate.LemmaStack.with_top lemmas ~f in
let control = [] (* FIXME *) in
let opaque = Vernacexpr.Opaque in
Expand Down
4 changes: 4 additions & 0 deletions language-server/dm/parTactic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ let assign_tac ~abstract res : unit Proofview.tactic =
tclUNIT ()
end)

[%%if coq = "8.18" || coq = "8.19"]
let command_focus = Proof.new_focus_kind ()
[%%else]
let command_focus = Proof.new_focus_kind "vscoq_command_focus"
[%%endif]

let worker_solve_one_goal { TacticJob.state; ast; goalno; goal } ~send_back =
let focus_cond = Proof.no_cond command_focus in
Expand Down
Loading
Loading