Update test outputs

This commit is contained in:
Louis Gesbert 2024-06-21 12:19:28 +02:00
parent 7d7dd47216
commit 812aeff736
4 changed files with 20 additions and 17 deletions

View File

@ -29,13 +29,13 @@ type Eoption = | ENone of unit | ESome of any
type S_in = { x_in: bool; } type S_in = { x_in: bool; }
type S = { z: integer; } type S = { z: integer; }
let topval closure_f : (closure_env, integer) → integer = let topval closure_f1 : (closure_env, integer) → integer =
λ (env: closure_env) (y: integer) → λ (env: closure_env) (y: integer) →
if (from_closure_env env).0 then y else - y if (from_closure_env env).0 then y else - y
let scope S (S_in: S_in {x_in: bool}): S {z: integer} = let scope S (S_in: S_in {x_in: bool}): S {z: integer} =
let get x : bool = S_in.x_in in let get x : bool = S_in.x_in in
let set f : ((closure_env, integer) → integer, closure_env) = let set f : ((closure_env, integer) → integer, closure_env) =
(closure_f, to_closure_env (x)) (closure_f1, to_closure_env (x))
in in
let set z : integer = f.0 f.1 -1 in let set z : integer = f.0 f.1 -1 in
return { S z = z; } return { S z = z; }
@ -81,7 +81,7 @@ let scope S2Use
} }
= =
let set fun : ((closure_env, integer) → decimal, closure_env) = let set fun : ((closure_env, integer) → decimal, closure_env) =
(closure_fun, to_closure_env ()) (closure_fun1, to_closure_env ())
in in
let set o : let set o :
(S2 { (S2 {
@ -95,14 +95,14 @@ let scope S2Use
(let result : S2 = S2 { S2_in cfun2_in = fun; } in (let result : S2 = S2 { S2_in cfun2_in = fun; } in
{ S2 { S2
dummy = result.dummy; dummy = result.dummy;
cfun2 = (closure_o, to_closure_env (result)); cfun2 = (closure_o1, to_closure_env (result));
}, },
let result : S2 = let result : S2 =
S2 { S2_in cfun2_in = (closure_o, to_closure_env ()); } S2 { S2_in cfun2_in = (closure_o3, to_closure_env ()); }
in in
{ S2 { S2
dummy = result.dummy; dummy = result.dummy;
cfun2 = (closure_o, to_closure_env (result)); cfun2 = (closure_o2, to_closure_env (result));
}) })
in in
return { S2Use o = o; } return { S2Use o = o; }

View File

@ -27,7 +27,7 @@ type Eoption = | ENone of unit | ESome of any
type S_in = { x_in: bool; } type S_in = { x_in: bool; }
type S = { f: ((closure_env, integer) → integer, closure_env); } type S = { f: ((closure_env, integer) → integer, closure_env); }
let topval closure_f : (closure_env, integer) → integer = let topval closure_f1 : (closure_env, integer) → integer =
λ (env: closure_env) (y: integer) → λ (env: closure_env) (y: integer) →
if (from_closure_env env).0 then y else - y if (from_closure_env env).0 then y else - y
let scope S let scope S
@ -36,7 +36,7 @@ let scope S
= =
let get x : bool = S_in.x_in in let get x : bool = S_in.x_in in
let set f : ((closure_env, integer) → integer, closure_env) = let set f : ((closure_env, integer) → integer, closure_env) =
(closure_f, to_closure_env (x)) (closure_f1, to_closure_env (x))
in in
return { S f = f; } return { S f = f; }

View File

@ -33,7 +33,7 @@ $ catala Typecheck --check-invariants
$ catala Lcalc -s T --avoid-exceptions -O --closure-conversion $ catala Lcalc -s T --avoid-exceptions -O --closure-conversion
let scope T (T_in: T_in): T {y: integer} = let scope T (T_in: T_in): T {y: integer} =
let set s : S {f: ((closure_env, integer) → integer, closure_env)} = let set s : S {f: ((closure_env, integer) → integer, closure_env)} =
{ S f = (closure_s, to_closure_env ()); } { S f = (closure_s1, to_closure_env ()); }
in in
let set y : integer = let set y : integer =
let code_and_env : ((closure_env, integer) → integer, closure_env) = let code_and_env : ((closure_env, integer) → integer, closure_env) =

View File

@ -72,7 +72,7 @@ type SubFoo2 = {
type Foo_in = { b_in: ((closure_env, unit) → eoption bool, closure_env); } type Foo_in = { b_in: ((closure_env, unit) → eoption bool, closure_env); }
type Foo = { z: integer; } type Foo = { z: integer; }
let topval closure_y : (closure_env, integer) → integer = let topval closure_y1 : (closure_env, integer) → integer =
λ (env: closure_env) (z: integer) → λ (env: closure_env) (z: integer) →
(from_closure_env env).0 + z (from_closure_env env).0 + z
let scope SubFoo1 let scope SubFoo1
@ -84,10 +84,10 @@ let scope SubFoo1
= =
let get x : integer = SubFoo1_in.x_in in let get x : integer = SubFoo1_in.x_in in
let set y : ((closure_env, integer) → integer, closure_env) = let set y : ((closure_env, integer) → integer, closure_env) =
(closure_y, to_closure_env (x)) (closure_y1, to_closure_env (x))
in in
return { SubFoo1 x = x; y = y; } return { SubFoo1 x = x; y = y; }
let topval closure_y : (closure_env, integer) → integer = let topval closure_y1 : (closure_env, integer) → integer =
λ (env: closure_env) (z: integer) → λ (env: closure_env) (z: integer) →
let env1 : (integer, integer) = from_closure_env env in let env1 : (integer, integer) = from_closure_env env in
((env1.1 + env1.0 + z)) ((env1.1 + env1.0 + z))
@ -101,16 +101,16 @@ let scope SubFoo2
let get x1 : integer = SubFoo2_in.x1_in in let get x1 : integer = SubFoo2_in.x1_in in
let get x2 : integer = SubFoo2_in.x2_in in let get x2 : integer = SubFoo2_in.x2_in in
let set y : ((closure_env, integer) → integer, closure_env) = let set y : ((closure_env, integer) → integer, closure_env) =
(closure_y, to_closure_env (x2, x1)) (closure_y1, to_closure_env (x2, x1))
in in
return { SubFoo2 x1 = x1; y = y; } return { SubFoo2 x1 = x1; y = y; }
let topval closure_r : (closure_env, integer) → integer = let topval closure_r2 : (closure_env, integer) → integer =
λ (env: closure_env) (param0: integer) → λ (env: closure_env) (param0: integer) →
let code_and_env : ((closure_env, integer) → integer, closure_env) = let code_and_env : ((closure_env, integer) → integer, closure_env) =
(from_closure_env env).0.y (from_closure_env env).0.y
in in
code_and_env.0 code_and_env.1 param0 code_and_env.0 code_and_env.1 param0
let topval closure_r : (closure_env, integer) → integer = let topval closure_r1 : (closure_env, integer) → integer =
λ (env: closure_env) (param0: integer) → λ (env: closure_env) (param0: integer) →
let code_and_env : ((closure_env, integer) → integer, closure_env) = let code_and_env : ((closure_env, integer) → integer, closure_env) =
(from_closure_env env).0.y (from_closure_env env).0.y
@ -139,7 +139,7 @@ let scope Foo
if b then if b then
let f : SubFoo1 = let f : SubFoo1 =
let result : SubFoo1 = SubFoo1 { SubFoo1_in x_in = 10; } in let result : SubFoo1 = SubFoo1 { SubFoo1_in x_in = 10; } in
{ SubFoo1 x = result.x; y = (closure_r, to_closure_env (result)); } { SubFoo1 x = result.x; y = (closure_r1, to_closure_env (result)); }
in in
{ Result r = f.y; q = f.x; } { Result r = f.y; q = f.x; }
else else
@ -147,7 +147,10 @@ let scope Foo
let result : SubFoo2 = let result : SubFoo2 =
SubFoo2 { SubFoo2_in x1_in = 10; x2_in = 10; } SubFoo2 { SubFoo2_in x1_in = 10; x2_in = 10; }
in in
{ SubFoo2 x1 = result.x1; y = (closure_r, to_closure_env (result)); } { SubFoo2
x1 = result.x1;
y = (closure_r2, to_closure_env (result));
}
in in
{ Result r = f.y; q = f.x1; } { Result r = f.y; q = f.x1; }
in in