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

Some fixes for antiquotations #3193

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 14 additions & 47 deletions ocaml/fstar-lib/generated/FStar_Extraction_ML_Term.ml

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

116 changes: 70 additions & 46 deletions ocaml/fstar-lib/generated/FStar_Reflection_V2_Embeddings.ml

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

50 changes: 50 additions & 0 deletions ocaml/fstar-lib/generated/FStar_Reflection_V2_Util.ml

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

28 changes: 8 additions & 20 deletions ocaml/fstar-lib/generated/FStar_SMTEncoding_EncodeTerm.ml

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

6 changes: 2 additions & 4 deletions ocaml/fstar-lib/generated/FStar_Syntax_Subst.ml

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

13 changes: 7 additions & 6 deletions ocaml/fstar-lib/generated/FStar_Syntax_Syntax.ml

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

26 changes: 6 additions & 20 deletions src/extraction/FStar.Extraction.ML.Term.fst
Original file line number Diff line number Diff line change
Expand Up @@ -1409,26 +1409,12 @@ and term_as_mlexpr' (g:uenv) (top:term) : (mlexpr * e_tag * mlty) =
E_PURE,
ml_int_ty

| Tm_quoted (qt, { qkind = Quote_static; antiquotations = (shift, aqs) }) ->
begin match R.inspect_ln qt with
| RD.Tv_BVar bv ->
(* If it's a variable, check whether it's an antiquotation or just a bvar node *)
if bv.index < shift then
(* just a local bvar *)
let tv' = RD.Tv_BVar bv in
let tv = EMB.embed tv' t.pos None EMB.id_norm_cb in
let t = U.mk_app (RC.refl_constant_term RC.fstar_refl_pack_ln) [S.as_arg tv] in
term_as_mlexpr g t
else
let tm = S.lookup_aq bv (shift, aqs) in
term_as_mlexpr g tm

| tv ->
(* Else, just embed recursively. *)
let tv = EMB.embed #_ #(RE.e_term_view_aq (shift, aqs)) tv t.pos None EMB.id_norm_cb in
let t = U.mk_app (RC.refl_constant_term RC.fstar_refl_pack_ln) [S.as_arg tv] in
term_as_mlexpr g t
end
| Tm_quoted (qt, qi) ->
let t' = Reflection.V2.Util.unfold_quotation qt qi in
if Env.debug (tcenv_of_uenv g) <| Options.Other "Extraction" then
BU.print2 ">> Inspected (%s) ~> (%s)\n" (Print.term_to_string t)
(Print.term_to_string t');
term_as_mlexpr g t'

| Tm_meta {tm=t; meta=Meta_monadic (m, _)} ->
//
Expand Down
Loading