Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes coq#16288: wrong extraction of primitive field in functors.
- The code for extracting a primitive projection was referencing the constant form of the projection. - The code for compiling the constant form of the projection was doing a call to the global table of projections which is however not fed in functors. - The declaration of constants bound to a projection had a small size and were then inlined. Instead of relying on the table of projections, we use the "match"-expanded form of the projections which has the advantage of be valid in all target languages. In particular, in OCaml extraction, this is anyway reprinted as a field. Note: we need to move the fake_match_projection function a bit earlier.
- Loading branch information
Showing
3 changed files
with
103 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(* Extraction of primitive projections within a functor were | ||
incorrectly referencing themselves *) | ||
Module Type Nop. End Nop. | ||
Module Empty. End Empty. | ||
Module M (N : Nop). | ||
Local Set Primitive Projections. | ||
Record M_t_NonEmpty elt := { M_m :> list elt }. | ||
Record M_t_NonEmpty' X Y := { a : X ; b : Y }. | ||
End M. | ||
Module M' := M Empty. | ||
Require Import Coq.extraction.Extraction. | ||
Require Import Coq.extraction.ExtrOcamlBasic. | ||
Extraction Language OCaml. | ||
Recursive Extraction M'. | ||
Extraction TestCompile M'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters