Printer: add parens after constructors

This commit is contained in:
Louis Gesbert 2023-12-19 14:44:35 +01:00
parent ad0afa2f64
commit 7233ec403a
6 changed files with 60 additions and 60 deletions

View File

@ -686,7 +686,7 @@ module ExprGen (C : EXPR_PARAM) = struct
StructField.format field
| EInj { e; cons; _ } ->
Format.fprintf fmt "@[<hv 2>%a@ %a@]" EnumConstructor.format cons
(rhs exprc) e
(paren ~rhs:false exprc) e
| EMatch { e; cases; _ } ->
Format.fprintf fmt "@[<v 0>@[<hv 2>%a@ %a@;<1 -2>%a@]@ %a@]" keyword
"match" (lhs exprc) e keyword "with"

View File

@ -66,11 +66,11 @@ let scope S (S_in: S_in {x_in: bool}): S {z: integer} =
(λ (_: unit) → true)
(λ (_: unit) →
ESome
let code_and_env :
((closure_env, integer) → integer * closure_env) =
f
in
code_and_env.0 code_and_env.1 -1))
(let code_and_env :
((closure_env, integer) → integer * closure_env) =
f
in
code_and_env.0 code_and_env.1 -1)))
with
| ENone _ → raise NoValueProvided
| ESome arg → arg

View File

@ -47,12 +47,12 @@ let scope S (S_in: S_in {x_in: list of integer}): S {y: integer} =
(λ (_: unit) → true)
(λ (_: unit) →
ESome
reduce
(λ (potential_max_1: integer) (potential_max_2: integer) →
if potential_max_1 < potential_max_2 then potential_max_1
else potential_max_2)
-1
x))
(reduce
(λ (potential_max_1: integer) (potential_max_2: integer) →
if potential_max_1 < potential_max_2 then potential_max_1
else potential_max_2)
-1
x)))
with
| ENone _ → raise NoValueProvided
| ESome arg → arg
@ -83,18 +83,18 @@ let scope S (S_in: S_in {x_in: list of integer}): S {y: integer} =
(λ (_: unit) → true)
(λ (_: unit) →
ESome
reduce
(λ (potential_max_1: integer) (potential_max_2: integer) →
if
(let potential_max : integer = potential_max_1 in
potential_max)
< let potential_max : integer = potential_max_2 in
potential_max
then
potential_max_1
else potential_max_2)
-1
x)
(reduce
(λ (potential_max_1: integer) (potential_max_2: integer) →
if
(let potential_max : integer = potential_max_1 in
potential_max)
< let potential_max : integer = potential_max_2 in
potential_max
then
potential_max_1
else potential_max_2)
-1
x))
]
(λ (_: unit) → false)
(λ (_: unit) → ENone ()))

View File

@ -66,11 +66,11 @@ let scope T (T_in: T_in): T {y: integer} =
(λ (_: unit) → true)
(λ (_: unit) →
ESome
let code_and_env :
((closure_env, integer) → integer * closure_env) =
s.f
in
code_and_env.0 code_and_env.1 2))
(let code_and_env :
((closure_env, integer) → integer * closure_env) =
s.f
in
code_and_env.0 code_and_env.1 2)))
with
| ENone _ → raise NoValueProvided
| ESome arg → arg

View File

@ -165,14 +165,14 @@ let scope Foo
(λ (_: unit) → true)
(λ (_: unit) →
ESome
match
(handle_default_opt
[]
(λ (_1: unit) → true)
(λ (_1: unit) → ESome true))
with
| ENone _1 → raise NoValueProvided
| ESome arg → arg))
(match
(handle_default_opt
[]
(λ (_1: unit) → true)
(λ (_1: unit) → ESome true))
with
| ENone _1 → raise NoValueProvided
| ESome arg → arg)))
with
| ENone _ → raise NoValueProvided
| ESome arg → arg
@ -219,11 +219,11 @@ let scope Foo
(λ (_: unit) → true)
(λ (_: unit) →
ESome
let code_and_env :
((closure_env, integer) → integer * closure_env) =
r.r
in
code_and_env.0 code_and_env.1 1))
(let code_and_env :
((closure_env, integer) → integer * closure_env) =
r.r
in
code_and_env.0 code_and_env.1 1)))
with
| ENone _ → raise NoValueProvided
| ESome arg → arg

View File

@ -110,15 +110,15 @@ f1 = λ (x: integer) →
(λ (_: unit) → true)
(λ (_: unit) →
ESome
let x1 : integer = x + 1 in
match
(handle_default_opt
[]
(λ (_1: unit) → true)
(λ (_1: unit) → ESome (x1 + 1)))
with
| ENone _1 → raise NoValueProvided
| ESome arg → arg))
(let x1 : integer = x + 1 in
match
(handle_default_opt
[]
(λ (_1: unit) → true)
(λ (_1: unit) → ESome (x1 + 1)))
with
| ENone _1 → raise NoValueProvided
| ESome arg → arg)))
with
| ENone _ → raise NoValueProvided
| ESome arg → arg
@ -130,15 +130,15 @@ f2 = λ (x: integer) →
(λ (_: unit) → true)
(λ (_: unit) →
ESome
let x1 : integer = x + 1 in
match
(handle_default_opt
[]
(λ (_1: unit) → true)
(λ (_1: unit) → ESome (x1 + 1)))
with
| ENone _1 → raise NoValueProvided
| ESome arg → arg))
(let x1 : integer = x + 1 in
match
(handle_default_opt
[]
(λ (_1: unit) → true)
(λ (_1: unit) → ESome (x1 + 1)))
with
| ENone _1 → raise NoValueProvided
| ESome arg → arg)))
with
| ENone _ → raise NoValueProvided
| ESome arg → arg