diff options
| author | Matthieu Sozeau | 2016-05-23 18:58:01 +0200 |
|---|---|---|
| committer | Matthieu Sozeau | 2016-05-23 18:58:01 +0200 |
| commit | 891a8a9f7ea3bb5b0b07dc5a2df51314135d8b53 (patch) | |
| tree | 1c5fd2dddb629dd8b7a8f3fa55e40b0fbf605d25 | |
| parent | 265be83a546b0bec6d01f6650f7489442293cb0e (diff) | |
Extraction/Projections: Fix bug #4710
Use the compatibility match construction to extract the compatibility
constant associated to a primitive projection.
| -rw-r--r-- | plugins/extraction/extraction.ml | 10 | ||||
| -rw-r--r-- | test-suite/bugs/closed/4710.v | 12 |
2 files changed, 20 insertions, 2 deletions
diff --git a/plugins/extraction/extraction.ml b/plugins/extraction/extraction.ml index 667721e670..bdf01e73b6 100644 --- a/plugins/extraction/extraction.ml +++ b/plugins/extraction/extraction.ml @@ -974,7 +974,10 @@ let extract_constant env kn cb = | (Info,TypeScheme) -> (match cb.const_body with | Undef _ -> warn_info (); mk_typ_ax () - | Def c -> mk_typ (Mod_subst.force_constr c) + | Def c -> + (match cb.const_proj with + | None -> mk_typ (Mod_subst.force_constr c) + | Some pb -> mk_typ pb.proj_body) | OpaqueDef c -> add_opaque r; if access_opaque () then @@ -983,7 +986,10 @@ let extract_constant env kn cb = | (Info,Default) -> (match cb.const_body with | Undef _ -> warn_info (); mk_ax () - | Def c -> mk_def (Mod_subst.force_constr c) + | Def c -> + (match cb.const_proj with + | None -> mk_def (Mod_subst.force_constr c) + | Some pb -> mk_def pb.proj_body) | OpaqueDef c -> add_opaque r; if access_opaque () then diff --git a/test-suite/bugs/closed/4710.v b/test-suite/bugs/closed/4710.v new file mode 100644 index 0000000000..fdc8501099 --- /dev/null +++ b/test-suite/bugs/closed/4710.v @@ -0,0 +1,12 @@ +Set Primitive Projections. +Record Foo' := Foo { foo : nat }. +Extraction foo. +Record Foo2 (a : nat) := Foo2c { foo2p : nat; foo2b : bool }. +Extraction Language Ocaml. +Extraction foo2p. + +Definition bla (x : Foo2 0) := foo2p _ x. +Extraction bla. + +Definition bla' (a : nat) (x : Foo2 a) := foo2b _ x. +Extraction bla'. |
