diff options
author | Son Ho | 2023-12-23 00:59:55 +0100 |
---|---|---|
committer | Son Ho | 2023-12-23 00:59:55 +0100 |
commit | a4decc7654bc6f3301c0174124d21fdbc2dbc708 (patch) | |
tree | f992f3bb64609bf12d033a1424873a8134c66617 /tests/lean | |
parent | ff9fe8aa1e13a7297f7c4f2c2554235361db038f (diff) |
Regenerate the files
Diffstat (limited to 'tests/lean')
-rw-r--r-- | tests/lean/Array.lean | 18 | ||||
-rw-r--r-- | tests/lean/BetreeMain/Funs.lean | 36 | ||||
-rw-r--r-- | tests/lean/External/Funs.lean | 3 | ||||
-rw-r--r-- | tests/lean/Hashmap/Funs.lean | 9 | ||||
-rw-r--r-- | tests/lean/HashmapMain/Funs.lean | 11 | ||||
-rw-r--r-- | tests/lean/NoNestedBorrows.lean | 36 | ||||
-rw-r--r-- | tests/lean/Paper.lean | 11 | ||||
-rw-r--r-- | tests/lean/PoloniusList.lean | 8 | ||||
-rw-r--r-- | tests/lean/Traits.lean | 3 |
9 files changed, 47 insertions, 88 deletions
diff --git a/tests/lean/Array.lean b/tests/lean/Array.lean index 20f3425e..7785a208 100644 --- a/tests/lean/Array.lean +++ b/tests/lean/Array.lean @@ -30,8 +30,7 @@ def array_to_mut_slice_ := do let (s1, to_slice_mut_back) ← Array.to_slice_mut T 32#usize s - let back := fun ret => to_slice_mut_back ret - Result.ret (s1, back) + Result.ret (s1, to_slice_mut_back) /- [array::array_len]: Source: 'src/array.rs', lines 25:0-25:40 -/ @@ -79,8 +78,7 @@ def index_mut_array := do let (t, index_mut_back) ← Array.index_mut_usize T 32#usize s i - let back := fun ret => index_mut_back ret - Result.ret (t, back) + Result.ret (t, index_mut_back) /- [array::index_slice]: Source: 'src/array.rs', lines 56:0-56:46 -/ @@ -95,8 +93,7 @@ def index_mut_slice := do let (t, index_mut_back) ← Slice.index_mut_usize T s i - let back := fun ret => index_mut_back ret - Result.ret (t, back) + Result.ret (t, index_mut_back) /- [array::slice_subslice_shared_]: Source: 'src/array.rs', lines 64:0-64:70 -/ @@ -117,8 +114,7 @@ def slice_subslice_mut_ core.slice.index.Slice.index_mut U32 (core.ops.range.Range Usize) (core.slice.index.SliceIndexRangeUsizeSliceTInst U32) x { start := y, end_ := z } - let back := fun ret => index_mut_back ret - Result.ret (s, back) + Result.ret (s, index_mut_back) /- [array::array_to_slice_shared_]: Source: 'src/array.rs', lines 72:0-72:54 -/ @@ -133,8 +129,7 @@ def array_to_slice_mut_ := do let (s, to_slice_mut_back) ← Array.to_slice_mut U32 32#usize x - let back := fun ret => to_slice_mut_back ret - Result.ret (s, back) + Result.ret (s, to_slice_mut_back) /- [array::array_subslice_shared_]: Source: 'src/array.rs', lines 80:0-80:74 -/ @@ -157,8 +152,7 @@ def array_subslice_mut_ (core.ops.index.IndexMutSliceTIInst U32 (core.ops.range.Range Usize) (core.slice.index.SliceIndexRangeUsizeSliceTInst U32)) x { start := y, end_ := z } - let back := fun ret => index_mut_back ret - Result.ret (s, back) + Result.ret (s, index_mut_back) /- [array::index_slice_0]: Source: 'src/array.rs', lines 88:0-88:38 -/ diff --git a/tests/lean/BetreeMain/Funs.lean b/tests/lean/BetreeMain/Funs.lean index 4e64d217..96daa197 100644 --- a/tests/lean/BetreeMain/Funs.lean +++ b/tests/lean/BetreeMain/Funs.lean @@ -107,8 +107,7 @@ divergent def betree.List.split_at let i ← n - 1#u64 let p ← betree.List.split_at T tl i let (ls0, ls1) := p - let l := ls0 - Result.ret (betree.List.Cons hd l, ls1) + Result.ret (betree.List.Cons hd ls0, ls1) | betree.List.Nil => Result.fail .panic /- [betree_main::betree::{betree_main::betree::List<T>#1}::push_front]: @@ -116,8 +115,7 @@ divergent def betree.List.split_at def betree.List.push_front (T : Type) (self : betree.List T) (x : T) : Result (betree.List T) := let (tl, _) := core.mem.replace (betree.List T) self betree.List.Nil - let l := tl - Result.ret (betree.List.Cons x l) + Result.ret (betree.List.Cons x tl) /- [betree_main::betree::{betree_main::betree::List<T>#1}::pop_front]: Source: 'src/betree.rs', lines 306:4-306:32 -/ @@ -159,8 +157,7 @@ divergent def betree.ListTupleU64T.partition_at_pivot do let p ← betree.ListTupleU64T.partition_at_pivot T tl pivot let (ls0, ls1) := p - let l := ls0 - Result.ret (betree.List.Cons (i, t) l, ls1) + Result.ret (betree.List.Cons (i, t) ls0, ls1) | betree.List.Nil => Result.ret (betree.List.Nil, betree.List.Nil) /- [betree_main::betree::{betree_main::betree::Leaf#3}::split]: @@ -194,9 +191,7 @@ divergent def betree.Node.lookup_first_message_for_key | betree.List.Cons x next_msgs => let (i, m) := x if i >= key - then - let back_'a := fun ret => Result.ret ret - Result.ret (betree.List.Cons (i, m) next_msgs, back_'a) + then Result.ret (betree.List.Cons (i, m) next_msgs, Result.ret) else do let (l, lookup_first_message_for_key_back) ← @@ -207,9 +202,7 @@ divergent def betree.Node.lookup_first_message_for_key let next_msgs1 ← lookup_first_message_for_key_back ret Result.ret (betree.List.Cons (i, m) next_msgs1) Result.ret (l, back_'a) - | betree.List.Nil => - let back_'a := fun ret => Result.ret ret - Result.ret (betree.List.Nil, back_'a) + | betree.List.Nil => Result.ret (betree.List.Nil, Result.ret) /- [betree_main::betree::{betree_main::betree::Node#5}::lookup_in_bindings]: Source: 'src/betree.rs', lines 636:4-636:80 -/ @@ -381,12 +374,8 @@ divergent def betree.Node.lookup_first_message_after_key let next_msgs1 ← lookup_first_message_after_key_back ret Result.ret (betree.List.Cons (k, m) next_msgs1) Result.ret (l, back_'a) - else - let back_'a := fun ret => Result.ret ret - Result.ret (betree.List.Cons (k, m) next_msgs, back_'a) - | betree.List.Nil => - let back_'a := fun ret => Result.ret ret - Result.ret (betree.List.Nil, back_'a) + else Result.ret (betree.List.Cons (k, m) next_msgs, Result.ret) + | betree.List.Nil => Result.ret (betree.List.Nil, Result.ret) /- [betree_main::betree::{betree_main::betree::Node#5}::apply_to_internal]: Source: 'src/betree.rs', lines 521:4-521:89 -/ @@ -478,9 +467,7 @@ divergent def betree.Node.lookup_mut_in_bindings | betree.List.Cons hd tl => let (i, i1) := hd if i >= key - then - let back_'a := fun ret => Result.ret ret - Result.ret (betree.List.Cons (i, i1) tl, back_'a) + then Result.ret (betree.List.Cons (i, i1) tl, Result.ret) else do let (l, lookup_mut_in_bindings_back) ← @@ -491,9 +478,7 @@ divergent def betree.Node.lookup_mut_in_bindings let tl1 ← lookup_mut_in_bindings_back ret Result.ret (betree.List.Cons (i, i1) tl1) Result.ret (l, back_'a) - | betree.List.Nil => - let back_'a := fun ret => Result.ret ret - Result.ret (betree.List.Nil, back_'a) + | betree.List.Nil => Result.ret (betree.List.Nil, Result.ret) /- [betree_main::betree::{betree_main::betree::Node#5}::apply_to_leaf]: Source: 'src/betree.rs', lines 460:4-460:87 -/ @@ -650,10 +635,9 @@ def betree.Node.apply Result (State × (betree.Node × betree.NodeIdCounter)) := do - let l := betree.List.Nil let (st1, p) ← betree.Node.apply_messages self params node_id_cnt (betree.List.Cons (key, - new_msg) l) st + new_msg) betree.List.Nil) st let (self1, node_id_cnt1) := p Result.ret (st1, (self1, node_id_cnt1)) diff --git a/tests/lean/External/Funs.lean b/tests/lean/External/Funs.lean index 88ced82d..db15aacc 100644 --- a/tests/lean/External/Funs.lean +++ b/tests/lean/External/Funs.lean @@ -25,8 +25,7 @@ def test_new_non_zero_u32 Source: 'src/external.rs', lines 17:0-17:17 -/ def test_vec : Result Unit := do - let v := alloc.vec.Vec.new U32 - let _ ← alloc.vec.Vec.push U32 v 0#u32 + let _ ← alloc.vec.Vec.push U32 (alloc.vec.Vec.new U32) 0#u32 Result.ret () /- Unit test for [external::test_vec] -/ diff --git a/tests/lean/Hashmap/Funs.lean b/tests/lean/Hashmap/Funs.lean index 32ed2b33..3978bfc7 100644 --- a/tests/lean/Hashmap/Funs.lean +++ b/tests/lean/Hashmap/Funs.lean @@ -41,8 +41,7 @@ def HashMap.new_with_capacity Result (HashMap T) := do - let v := alloc.vec.Vec.new (List T) - let slots ← HashMap.allocate_slots T v capacity + let slots ← HashMap.allocate_slots T (alloc.vec.Vec.new (List T)) capacity let i ← capacity * max_load_dividend let i1 ← i / max_load_divisor Result.ret @@ -102,8 +101,7 @@ divergent def HashMap.insert_in_list_loop do let (b, back) ← HashMap.insert_in_list_loop T key value tl Result.ret (b, List.Cons ckey cvalue back) - | List.Nil => let l := List.Nil - Result.ret (true, List.Cons key value l) + | List.Nil => Result.ret (true, List.Cons key value List.Nil) /- [hashmap::{hashmap::HashMap<T>}::insert_in_list]: Source: 'src/hashmap.rs', lines 97:4-97:71 -/ @@ -315,8 +313,7 @@ def HashMap.get_mut_in_list := do let (t, back_'a) ← HashMap.get_mut_in_list_loop T ls key - let back_'a1 := fun ret => back_'a ret - Result.ret (t, back_'a1) + Result.ret (t, back_'a) /- [hashmap::{hashmap::HashMap<T>}::get_mut]: Source: 'src/hashmap.rs', lines 257:4-257:67 -/ diff --git a/tests/lean/HashmapMain/Funs.lean b/tests/lean/HashmapMain/Funs.lean index 9bfb5070..ebed2570 100644 --- a/tests/lean/HashmapMain/Funs.lean +++ b/tests/lean/HashmapMain/Funs.lean @@ -42,8 +42,9 @@ def hashmap.HashMap.new_with_capacity Result (hashmap.HashMap T) := do - let v := alloc.vec.Vec.new (hashmap.List T) - let slots ← hashmap.HashMap.allocate_slots T v capacity + let slots ← + hashmap.HashMap.allocate_slots T (alloc.vec.Vec.new (hashmap.List T)) + capacity let i ← capacity * max_load_dividend let i1 ← i / max_load_divisor Result.ret @@ -105,8 +106,7 @@ divergent def hashmap.HashMap.insert_in_list_loop let (b, back) ← hashmap.HashMap.insert_in_list_loop T key value tl Result.ret (b, hashmap.List.Cons ckey cvalue back) | hashmap.List.Nil => - let l := hashmap.List.Nil - Result.ret (true, hashmap.List.Cons key value l) + Result.ret (true, hashmap.List.Cons key value hashmap.List.Nil) /- [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::insert_in_list]: Source: 'src/hashmap.rs', lines 97:4-97:71 -/ @@ -328,8 +328,7 @@ def hashmap.HashMap.get_mut_in_list := do let (t, back_'a) ← hashmap.HashMap.get_mut_in_list_loop T ls key - let back_'a1 := fun ret => back_'a ret - Result.ret (t, back_'a1) + Result.ret (t, back_'a) /- [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::get_mut]: Source: 'src/hashmap.rs', lines 257:4-257:67 -/ diff --git a/tests/lean/NoNestedBorrows.lean b/tests/lean/NoNestedBorrows.lean index cb0aac10..0dd29429 100644 --- a/tests/lean/NoNestedBorrows.lean +++ b/tests/lean/NoNestedBorrows.lean @@ -244,10 +244,9 @@ def test_list1 : Result Unit := Source: 'src/no_nested_borrows.rs', lines 208:0-208:18 -/ def test_box1 : Result Unit := do - let b := 0#i32 - let (_, deref_mut_back) ← alloc.boxed.Box.deref_mut I32 b - let b1 ← deref_mut_back 1#i32 - let x ← alloc.boxed.Box.deref I32 b1 + let (_, deref_mut_back) ← alloc.boxed.Box.deref_mut I32 0#i32 + let b ← deref_mut_back 1#i32 + let x ← alloc.boxed.Box.deref I32 b if not (x = 1#i32) then Result.fail .panic else Result.ret () @@ -297,8 +296,7 @@ def is_cons (T : Type) (l : List T) : Result Bool := Source: 'src/no_nested_borrows.rs', lines 253:0-253:21 -/ def test_is_cons : Result Unit := do - let l := List.Nil - let b ← is_cons I32 (List.Cons 0#i32 l) + let b ← is_cons I32 (List.Cons 0#i32 List.Nil) if not b then Result.fail .panic else Result.ret () @@ -317,8 +315,7 @@ def split_list (T : Type) (l : List T) : Result (T × (List T)) := Source: 'src/no_nested_borrows.rs', lines 267:0-267:24 -/ def test_split_list : Result Unit := do - let l := List.Nil - let p ← split_list I32 (List.Cons 0#i32 l) + let p ← split_list I32 (List.Cons 0#i32 List.Nil) let (hd, _) := p if not (hd = 0#i32) then Result.fail .panic @@ -441,31 +438,30 @@ def list_rev (T : Type) (l : List T) : Result (List T) := Source: 'src/no_nested_borrows.rs', lines 398:0-398:28 -/ def test_list_functions : Result Unit := do - let l := List.Nil - let l1 := List.Cons 2#i32 l - let l2 := List.Cons 1#i32 l1 - let i ← list_length I32 (List.Cons 0#i32 l2) + let l := List.Cons 2#i32 List.Nil + let l1 := List.Cons 1#i32 l + let i ← list_length I32 (List.Cons 0#i32 l1) if not (i = 3#u32) then Result.fail .panic else do - let i1 ← list_nth_shared I32 (List.Cons 0#i32 l2) 0#u32 + let i1 ← list_nth_shared I32 (List.Cons 0#i32 l1) 0#u32 if not (i1 = 0#i32) then Result.fail .panic else do - let i2 ← list_nth_shared I32 (List.Cons 0#i32 l2) 1#u32 + let i2 ← list_nth_shared I32 (List.Cons 0#i32 l1) 1#u32 if not (i2 = 1#i32) then Result.fail .panic else do - let i3 ← list_nth_shared I32 (List.Cons 0#i32 l2) 2#u32 + let i3 ← list_nth_shared I32 (List.Cons 0#i32 l1) 2#u32 if not (i3 = 2#i32) then Result.fail .panic else do let (_, list_nth_mut_back) ← - list_nth_mut I32 (List.Cons 0#i32 l2) 1#u32 + list_nth_mut I32 (List.Cons 0#i32 l1) 1#u32 let ls ← list_nth_mut_back 3#i32 let i4 ← list_nth_shared I32 ls 0#u32 if not (i4 = 0#i32) @@ -512,9 +508,7 @@ def id_mut_pair3 (T1 T2 : Type) (x : T1) (y : T2) : Result ((T1 × T2) × (T1 → Result T1) × (T2 → Result T2)) := - let back_'a := fun ret => Result.ret ret - let back_'b := fun ret => Result.ret ret - Result.ret ((x, y), back_'a, back_'b) + Result.ret ((x, y), Result.ret, Result.ret) /- [no_nested_borrows::id_mut_pair4]: Source: 'src/no_nested_borrows.rs', lines 426:0-426:92 -/ @@ -523,9 +517,7 @@ def id_mut_pair4 Result ((T1 × T2) × (T1 → Result T1) × (T2 → Result T2)) := let (t, t1) := p - let back_'a := fun ret => Result.ret ret - let back_'b := fun ret => Result.ret ret - Result.ret ((t, t1), back_'a, back_'b) + Result.ret ((t, t1), Result.ret, Result.ret) /- [no_nested_borrows::StructWithTuple] Source: 'src/no_nested_borrows.rs', lines 433:0-433:34 -/ diff --git a/tests/lean/Paper.lean b/tests/lean/Paper.lean index 015fec84..a35c8db0 100644 --- a/tests/lean/Paper.lean +++ b/tests/lean/Paper.lean @@ -95,13 +95,12 @@ divergent def sum (l : List I32) : Result I32 := Source: 'src/paper.rs', lines 68:0-68:17 -/ def test_nth : Result Unit := do - let l := List.Nil - let l1 := List.Cons 3#i32 l - let l2 := List.Cons 2#i32 l1 - let (x, list_nth_mut_back) ← list_nth_mut I32 (List.Cons 1#i32 l2) 2#u32 + let l := List.Cons 3#i32 List.Nil + let l1 := List.Cons 2#i32 l + let (x, list_nth_mut_back) ← list_nth_mut I32 (List.Cons 1#i32 l1) 2#u32 let x1 ← x + 1#i32 - let l3 ← list_nth_mut_back x1 - let i ← sum l3 + let l2 ← list_nth_mut_back x1 + let i ← sum l2 if not (i = 7#i32) then Result.fail .panic else Result.ret () diff --git a/tests/lean/PoloniusList.lean b/tests/lean/PoloniusList.lean index a485adbe..59c557a0 100644 --- a/tests/lean/PoloniusList.lean +++ b/tests/lean/PoloniusList.lean @@ -20,9 +20,7 @@ divergent def get_list_at_x match ls with | List.Cons hd tl => if hd = x - then - let back_'a := fun ret => Result.ret ret - Result.ret (List.Cons hd tl, back_'a) + then Result.ret (List.Cons hd tl, Result.ret) else do let (l, get_list_at_x_back) ← get_list_at_x tl x @@ -32,8 +30,6 @@ divergent def get_list_at_x let tl1 ← get_list_at_x_back ret Result.ret (List.Cons hd tl1) Result.ret (l, back_'a) - | List.Nil => - let back_'a := fun ret => Result.ret ret - Result.ret (List.Nil, back_'a) + | List.Nil => Result.ret (List.Nil, Result.ret) end polonius_list diff --git a/tests/lean/Traits.lean b/tests/lean/Traits.lean index 63d07d85..35f9e5bf 100644 --- a/tests/lean/Traits.lean +++ b/tests/lean/Traits.lean @@ -288,8 +288,7 @@ def use_with_const_ty1 (H : Type) (LEN : Usize) (WithConstTyHLENInst : WithConstTy H LEN) : Result Usize := - let i := WithConstTyHLENInst.LEN1 - Result.ret i + Result.ret WithConstTyHLENInst.LEN1 /- [traits::use_with_const_ty2]: Source: 'src/traits.rs', lines 187:0-187:73 -/ |