Skip to content

Commit d41589f

Browse files
committed
Extraction: sink applications into lets.
1 parent f5539ec commit d41589f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/extraction/FStarC.Extraction.ML.Term.fst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,14 @@ and term_as_mlexpr' (g:uenv) (top:term) : (mlexpr & e_tag & mlty) =
16611661
(Format.fmt1 "Cannot extract %s (reify effect is not set)" (show top))
16621662
)
16631663

1664+
(* Push applications into let bodies *)
1665+
| Tm_let {lbs; body} ->
1666+
term_as_mlexpr g { head with n = Tm_let { lbs; body = { t with n = Tm_app { hd=body; args } } } }
1667+
1668+
(* Combine nested applications *)
1669+
| Tm_app {hd=hd; args=args0} ->
1670+
term_as_mlexpr g { t with n = Tm_app { hd=hd; args=args0@args } }
1671+
16641672
| _ ->
16651673

16661674
let rec extract_app is_data (mlhead, mlargs_f) (f(*:e_tag*), t (* the type of (mlhead mlargs) *)) restArgs =

0 commit comments

Comments
 (0)