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

Resugaring for dependent tuples #3316

Merged
merged 14 commits into from
Jun 17, 2024
Merged

Conversation

mtzguido
Copy link
Member

@mtzguido mtzguido commented Jun 14, 2024

This PR introduces resugaring for dependent tuples (we had none, except for printing out dtupleN explicitly) and fixes some other problems with resugaring of tuples. See this snippet:

(* Basic dtuple3 *)
let _ = (a:int & b:int & z:int{z == a+b})

(* tuple3 and nested tuple2: all printed the same *)
let _ = int & int & int
let _ = ((int & int) & int)
let _ = (int & (int & int))

(* printed as int * bool *)
let _ = tuple4 int bool

Before (output with --dump_module):

Exports: [
private
let _ =
  FStar.Pervasives.dtuple3 Prims.int (fun _ -> Prims.int) (fun a b -> z: Prims.int{z == a + b})
private
let _ = Prims.int * Prims.int * Prims.int
private
let _ = Prims.int * Prims.int * Prims.int
private
let _ = Prims.int * Prims.int * Prims.int
private
let _ = Prims.int * Prims.bool
]

After:

Exports: [
private
let _ = a: Prims.int & b: Prims.int & z: Prims.int{z == a + b}
private
let _ = Prims.int & Prims.int & Prims.int
private
let _ = (Prims.int & Prims.int) & Prims.int
private
let _ = Prims.int & (Prims.int & Prims.int)
private
let _ = FStar.Pervasives.Native.tuple4 Prims.int Prims.bool
]

Also:
Fixes #2245

@mtzguido mtzguido mentioned this pull request Jun 14, 2024
@mtzguido
Copy link
Member Author

This PR will also print out tuples using & instead of *. I propose we switch to & for all tuples consistently.

@mtzguido mtzguido merged commit 0d25f0b into FStarLang:master Jun 17, 2024
2 checks passed
@mtzguido mtzguido deleted the dtuple_resugar branch June 17, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error 189 badly pretty-print tuples of 3+ elements
1 participant