Added a smoke test for local scopes

This commit is contained in:
Dmitry Boulytchev 2019-09-19 16:57:41 +03:00
parent 5527013a7f
commit a3b12425fd
4 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1 @@
> > > 8

8
regression/test056.expr Normal file
View file

@ -0,0 +1,8 @@
fun test (a, b, c) {
local x = a + b, y = b + c;
{local e = x + y;
return e
}
}
write (test (read (), read (), read ()))

3
regression/test056.input Normal file
View file

@ -0,0 +1,3 @@
1
2
3

View file

@ -556,7 +556,7 @@ module Expr =
let vars, body =
List.fold_left
(fun (vs, bd) -> function
| (name, `Variable value) -> name :: vs, (match value with None -> bd | Some v -> Seq (Assign (Var name, v), bd))
| (name, `Variable value) -> name :: vs, (match value with None -> bd | Some v -> Seq (Assign (Ref name, v), bd))
| _ -> invalid_arg "function"
)
([], expr)