diff options
author | Son Ho | 2023-11-21 11:46:10 +0100 |
---|---|---|
committer | Son Ho | 2023-11-21 11:46:10 +0100 |
commit | 46ab0fc047c69d14e52415bd8b76be167771cd58 (patch) | |
tree | 6ae52ac6fc36b5b392b3f211b030013fb7d82af1 /tests/fstar | |
parent | 5e92ae6b361f9221f5c5f9a39ab4c28a36597a77 (diff) |
Regenerate the Traits files
Diffstat (limited to 'tests/fstar')
-rw-r--r-- | tests/fstar/traits/Traits.fst | 121 |
1 files changed, 62 insertions, 59 deletions
diff --git a/tests/fstar/traits/Traits.fst b/tests/fstar/traits/Traits.fst index 318efa2b..7edb27c1 100644 --- a/tests/fstar/traits/Traits.fst +++ b/tests/fstar/traits/Traits.fst @@ -8,12 +8,12 @@ open Primitives (** Trait declaration: [traits::BoolTrait] *) noeq type boolTrait_t (self : Type0) = { get_bool : self -> result bool; } -(** [traits::Bool::{0}::get_bool]: forward function *) +(** [traits::{bool}::get_bool]: forward function *) let bool_get_bool (self : bool) : result bool = Return self -(** Trait implementation: [traits::Bool::{0}] *) -let bool_BoolTraitInst : boolTrait_t bool = { get_bool = bool_get_bool; } +(** Trait implementation: [traits::{bool}] *) +let traits_BoolTraitBoolInst : boolTrait_t bool = { get_bool = bool_get_bool; } (** [traits::BoolTrait::ret_true]: forward function *) let boolTrait_ret_true @@ -25,21 +25,24 @@ let boolTrait_ret_true (** [traits::test_bool_trait_bool]: forward function *) let test_bool_trait_bool (x : bool) : result bool = let* b = bool_get_bool x in - if b then boolTrait_ret_true bool_BoolTraitInst x else Return false + if b then boolTrait_ret_true traits_BoolTraitBoolInst x else Return false -(** [traits::Option::{1}::get_bool]: forward function *) +(** [traits::{core::option::Option<T>#1}::get_bool]: forward function *) let option_get_bool (t : Type0) (self : option t) : result bool = begin match self with | None -> Return false | Some x -> Return true end -(** Trait implementation: [traits::Option::{1}] *) -let option_BoolTraitInst (t : Type0) : boolTrait_t (option t) = { +(** Trait implementation: [traits::{core::option::Option<T>#1}] *) +let traits_BoolTraitcoreoptionOptionTInst (t : Type0) : boolTrait_t (option t) + = { get_bool = option_get_bool t; } (** [traits::test_bool_trait_option]: forward function *) let test_bool_trait_option (t : Type0) (x : option t) : result bool = let* b = option_get_bool t x in - if b then boolTrait_ret_true (option_BoolTraitInst t) x else Return false + if b + then boolTrait_ret_true (traits_BoolTraitcoreoptionOptionTInst t) x + else Return false (** [traits::test_bool_trait]: forward function *) let test_bool_trait (t : Type0) (inst : boolTrait_t t) (x : t) : result bool = @@ -48,29 +51,29 @@ let test_bool_trait (t : Type0) (inst : boolTrait_t t) (x : t) : result bool = (** Trait declaration: [traits::ToU64] *) noeq type toU64_t (self : Type0) = { to_u64 : self -> result u64; } -(** [traits::u64::{2}::to_u64]: forward function *) +(** [traits::{u64#2}::to_u64]: forward function *) let u64_to_u64 (self : u64) : result u64 = Return self -(** Trait implementation: [traits::u64::{2}] *) -let u64_ToU64Inst : toU64_t u64 = { to_u64 = u64_to_u64; } +(** Trait implementation: [traits::{u64#2}] *) +let traits_ToU64U64Inst : toU64_t u64 = { to_u64 = u64_to_u64; } -(** [traits::Tuple2::{3}::to_u64]: forward function *) -let tuple2_to_u64 - (a : Type0) (inst : toU64_t a) (self : (a & a)) : result u64 = +(** [traits::{(A, A)#3}::to_u64]: forward function *) +let pair_to_u64 (a : Type0) (inst : toU64_t a) (self : (a & a)) : result u64 = let (x, x0) = self in let* i = inst.to_u64 x in let* i0 = inst.to_u64 x0 in u64_add i i0 -(** Trait implementation: [traits::Tuple2::{3}] *) -let tuple2_ToU64Inst (a : Type0) (inst : toU64_t a) : toU64_t (a & a) = { - to_u64 = tuple2_to_u64 a inst; +(** Trait implementation: [traits::{(A, A)#3}] *) +let traits_ToU64TupleAAInst (a : Type0) (inst : toU64_t a) : toU64_t (a & a) + = { + to_u64 = pair_to_u64 a inst; } (** [traits::f]: forward function *) let f (t : Type0) (inst : toU64_t t) (x : (t & t)) : result u64 = - tuple2_to_u64 t inst x + pair_to_u64 t inst x (** [traits::g]: forward function *) let g (t : Type0) (inst : toU64_t (t & t)) (x : (t & t)) : result u64 = @@ -83,20 +86,20 @@ let h0 (x : u64) : result u64 = (** [traits::Wrapper] *) type wrapper_t (t : Type0) = { x : t; } -(** [traits::Wrapper::{4}::to_u64]: forward function *) +(** [traits::{traits::Wrapper<T>#4}::to_u64]: forward function *) let wrapper_to_u64 (t : Type0) (inst : toU64_t t) (self : wrapper_t t) : result u64 = inst.to_u64 self.x -(** Trait implementation: [traits::Wrapper::{4}] *) -let wrapper_ToU64Inst (t : Type0) (inst : toU64_t t) : toU64_t (wrapper_t t) - = { +(** Trait implementation: [traits::{traits::Wrapper<T>#4}] *) +let traits_ToU64traitsWrapperTInst (t : Type0) (inst : toU64_t t) : toU64_t + (wrapper_t t) = { to_u64 = wrapper_to_u64 t inst; } (** [traits::h1]: forward function *) let h1 (x : wrapper_t u64) : result u64 = - wrapper_to_u64 u64 u64_ToU64Inst x + wrapper_to_u64 u64 traits_ToU64U64Inst x (** [traits::h2]: forward function *) let h2 (t : Type0) (inst : toU64_t t) (x : wrapper_t t) : result u64 = @@ -105,12 +108,12 @@ let h2 (t : Type0) (inst : toU64_t t) (x : wrapper_t t) : result u64 = (** Trait declaration: [traits::ToType] *) noeq type toType_t (self t : Type0) = { to_type : self -> result t; } -(** [traits::u64::{5}::to_type]: forward function *) +(** [traits::{u64#5}::to_type]: forward function *) let u64_to_type (self : u64) : result bool = Return (self > 0) -(** Trait implementation: [traits::u64::{5}] *) -let u64_ToTypeInst : toType_t u64 bool = { to_type = u64_to_type; } +(** Trait implementation: [traits::{u64#5}] *) +let traits_ToTypeU64BoolInst : toType_t u64 bool = { to_type = u64_to_type; } (** Trait declaration: [traits::OfType] *) noeq type ofType_t (self : Type0) = { @@ -141,26 +144,26 @@ let h4 (** [traits::TestType] *) type testType_t (t : Type0) = { _0 : t; } -(** [traits::TestType::{6}::test::TestType1] *) +(** [traits::{traits::TestType<T>#6}::test::TestType1] *) type testType_test_TestType1_t = { _0 : u64; } -(** Trait declaration: [traits::TestType::{6}::test::TestTrait] *) +(** Trait declaration: [traits::{traits::TestType<T>#6}::test::TestTrait] *) noeq type testType_test_TestTrait_t (self : Type0) = { test : self -> result bool; } -(** [traits::TestType::{6}::test::TestType1::{0}::test]: forward function *) +(** [traits::{traits::TestType<T>#6}::test::{traits::{traits::TestType<T>#6}::test::TestType1}::test]: forward function *) let testType_test_TestType1_test (self : testType_test_TestType1_t) : result bool = Return (self._0 > 1) -(** Trait implementation: [traits::TestType::{6}::test::TestType1::{0}] *) -let testType_test_TestType1_TestType_test_TestTraitInst : +(** Trait implementation: [traits::{traits::TestType<T>#6}::test::{traits::{traits::TestType<T>#6}::test::TestType1}] *) +let traits_TestType_test_TestTraittraitstraitsTestTypeTtestTestType1Inst : testType_test_TestTrait_t testType_test_TestType1_t = { test = testType_test_TestType1_test; } -(** [traits::TestType::{6}::test]: forward function *) +(** [traits::{traits::TestType<T>#6}::test]: forward function *) let testType_test (t : Type0) (inst : toU64_t t) (self : testType_t t) (x : t) : result bool = let* x0 = inst.to_u64 x in @@ -169,14 +172,14 @@ let testType_test (** [traits::BoolWrapper] *) type boolWrapper_t = { _0 : bool; } -(** [traits::BoolWrapper::{7}::to_type]: forward function *) +(** [traits::{traits::BoolWrapper#7}::to_type]: forward function *) let boolWrapper_to_type (t : Type0) (inst : toType_t bool t) (self : boolWrapper_t) : result t = inst.to_type self._0 -(** Trait implementation: [traits::BoolWrapper::{7}] *) -let boolWrapper_ToTypeInst (t : Type0) (inst : toType_t bool t) : toType_t - boolWrapper_t t = { +(** Trait implementation: [traits::{traits::BoolWrapper#7}] *) +let traits_ToTypetraitsBoolWrapperTInst (t : Type0) (inst : toType_t bool t) : + toType_t boolWrapper_t t = { to_type = boolWrapper_to_type t inst; } @@ -194,22 +197,22 @@ noeq type withConstTy_t (self : Type0) (len : usize) = { f : tW -> array u8 len -> result tW; } -(** [traits::Bool::{8}::LEN1] *) +(** [traits::{bool#8}::LEN1] *) let bool_len1_body : result usize = Return 12 let bool_len1_c : usize = eval_global bool_len1_body -(** [traits::Bool::{8}::f]: merged forward/backward function +(** [traits::{bool#8}::f]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) let bool_f (i : u64) (a : array u8 32) : result u64 = Return i -(** Trait implementation: [traits::Bool::{8}] *) -let bool_WithConstTyInst : withConstTy_t bool 32 = { +(** Trait implementation: [traits::{bool#8}] *) +let traits_WithConstTyBool32Inst : withConstTy_t bool 32 = { cLEN1 = bool_len1_c; cLEN2 = with_const_ty_len2_c; tV = u8; tW = u64; - tW_clause_0 = u64_ToU64Inst; + tW_clause_0 = traits_ToU64U64Inst; f = bool_f; } @@ -284,12 +287,12 @@ noeq type childTrait1_t (self : Type0) = { parent_clause_0 : parentTrait1_t self; } -(** Trait implementation: [traits::usize::{9}] *) -let usize_ParentTrait1Inst : parentTrait1_t usize = () +(** Trait implementation: [traits::{usize#9}] *) +let traits_ParentTrait1UsizeInst : parentTrait1_t usize = () -(** Trait implementation: [traits::usize::{10}] *) -let usize_ChildTrait1Inst : childTrait1_t usize = { - parent_clause_0 = usize_ParentTrait1Inst; +(** Trait implementation: [traits::{usize#10}] *) +let traits_ChildTrait1UsizeInst : childTrait1_t usize = { + parent_clause_0 = traits_ParentTrait1UsizeInst; } (** Trait declaration: [traits::Iterator] *) @@ -327,29 +330,25 @@ noeq type childTrait2_t (self : Type0) = { convert : parent_clause_0.tU -> result parent_clause_0.tU_clause_0.tTarget; } -(** Trait implementation: [traits::u32::{11}] *) -let u32_WithTargetInst : withTarget_t u32 = { tTarget = u32; } +(** Trait implementation: [traits::{u32#11}] *) +let traits_WithTargetU32Inst : withTarget_t u32 = { tTarget = u32; } -(** Trait implementation: [traits::u32::{12}] *) -let u32_ParentTrait2Inst : parentTrait2_t u32 = { +(** Trait implementation: [traits::{u32#12}] *) +let traits_ParentTrait2U32Inst : parentTrait2_t u32 = { tU = u32; - tU_clause_0 = u32_WithTargetInst; + tU_clause_0 = traits_WithTargetU32Inst; } -(** [traits::u32::{13}::convert]: forward function *) +(** [traits::{u32#13}::convert]: forward function *) let u32_convert (x : u32) : result u32 = Return x -(** Trait implementation: [traits::u32::{13}] *) -let u32_ChildTrait2Inst : childTrait2_t u32 = { - parent_clause_0 = u32_ParentTrait2Inst; +(** Trait implementation: [traits::{u32#13}] *) +let traits_ChildTrait2U32Inst : childTrait2_t u32 = { + parent_clause_0 = traits_ParentTrait2U32Inst; convert = u32_convert; } -(** [traits::incr_u32]: forward function *) -let incr_u32 (x : u32) : result u32 = - u32_add x 1 - (** Trait declaration: [traits::CFnOnce] *) noeq type cFnOnce_t (self args : Type0) = { tOutput : Type0; @@ -369,3 +368,7 @@ noeq type cFn_t (self args : Type0) = { call_mut : self -> args -> result parent_clause_0.parent_clause_0.tOutput; } +(** [traits::incr_u32]: forward function *) +let incr_u32 (x : u32) : result u32 = + u32_add x 1 + |