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

SyntaxExtension: handle ticks in declarations #228

Merged
merged 3 commits into from
Oct 5, 2024
Merged
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
10 changes: 10 additions & 0 deletions share/pulse/examples/Test.GenOrder2.A.fsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Test.GenOrder2.A

#lang-pulse
open Pulse

val foo : int -> int -> slprop

fn flip ()
requires foo 'x 'y
ensures foo 'y 'x
12 changes: 12 additions & 0 deletions share/pulse/examples/Test.GenOrder2.B.fst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Test.GenOrder2.B

#lang-pulse
open Pulse
open Test.GenOrder2.A

fn test ()
requires foo 1 2
ensures foo 2 1
{
flip () #1 #2;
}
94 changes: 64 additions & 30 deletions src/ocaml/plugin/generated/PulseSyntaxExtension_Desugar.ml

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

7 changes: 7 additions & 0 deletions src/syntax_extension/PulseSyntaxExtension.Desugar.fst
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,13 @@ and desugar_decl (env:env_t)

| Sugar.FnDecl { id; binders; ascription=Inl ascription; range } ->
let! env, bs, bvs = desugar_binders env binders in

(* Process ticks *)
let fvs = free_vars_comp env ascription in
let! env, bs', bvs' = idents_as_binders env fvs in
let bs = bs@bs' in
let bvs = bvs@bvs' in

let! comp = desugar_computation_type env ascription in
let! qbs = map2 faux bs bvs in
let comp = close_comp_bvs comp (List.Tot.map (fun (_,_,bv) -> bv) qbs) in
Expand Down
Loading