add test for nested for collection loops (not supported yet)
This commit is contained in:
parent
402d849cec
commit
a140e12394
@ -1068,7 +1068,11 @@ and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun
|
||||
let%bind captured_name_list = Self_ast_simplified.fold_expression
|
||||
(fun (prev : type_name list) (ass_exp : expression) ->
|
||||
match ass_exp.expression with
|
||||
| E_assign ( name , _ , _ ) -> ok (name::prev)
|
||||
| E_assign ( name , _ , _ ) ->
|
||||
if (String.contains name '#') then
|
||||
ok prev
|
||||
else
|
||||
ok (name::prev)
|
||||
| _ -> ok prev )
|
||||
[]
|
||||
for_body in
|
||||
|
@ -136,6 +136,21 @@ function for_collection_map_k (var nee : unit) : string is block {
|
||||
end
|
||||
} with st
|
||||
|
||||
// function nested_for_collection (var nee : unit) : (int*string) is block {
|
||||
// var myint : int := 0;
|
||||
// var myst : string := "";
|
||||
// var mylist : list(int) := list 1 ; 2 ; 3 end ;
|
||||
// for i : int in list mylist
|
||||
// begin
|
||||
// myint := myint + i ;
|
||||
// var myset : set(string) := set "1" ; "2" ; "3" end ;
|
||||
// for st : string in set myset
|
||||
// begin
|
||||
// myst := myst ^ st ;
|
||||
// end
|
||||
// end
|
||||
// } with (myint,myst)
|
||||
|
||||
function dummy (const n : nat) : nat is block {
|
||||
while (False) block { skip }
|
||||
} with n
|
||||
|
@ -688,6 +688,9 @@ let loop () : unit result =
|
||||
let%bind () =
|
||||
let expected = (e_int 20) in
|
||||
expect_eq program "for_collection_comp_with_acc" input expected in
|
||||
(* let%bind () =
|
||||
let expected = e_pair (e_int 6) (e_string "123123123") in
|
||||
expect_eq program "nested_for_collection" input expected in *)
|
||||
let%bind () =
|
||||
let ez lst =
|
||||
let open Ast_simplified.Combinators in
|
||||
|
Loading…
Reference in New Issue
Block a user