diff --git a/tests/coq/misc/Issue270LoopList.v b/tests/coq/misc/Issue270LoopList.v new file mode 100644 index 00000000..aabf65c8 --- /dev/null +++ b/tests/coq/misc/Issue270LoopList.v @@ -0,0 +1,33 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [issue_270_loop_list] *) +Require Import Primitives. +Import Primitives. +Require Import Coq.ZArith.ZArith. +Require Import List. +Import ListNotations. +Local Open Scope Primitives_scope. +Module Issue270LoopList. + +(** [issue_270_loop_list::List] + Source: 'tests/src/issue-270-loop-list.rs', lines 2:0-5:1 *) +Inductive List_t (T : Type) := +| List_Cons : T -> List_t T -> List_t T +| List_Nil : List_t T +. + +Arguments List_Cons { _ }. +Arguments List_Nil { _ }. + +(** [issue_270_loop_list::foo]: loop 0: + Source: 'tests/src/issue-270-loop-list.rs', lines 11:8-14:9 *) +Fixpoint foo_loop (t : List_t (List_t u8)) : result unit := + match t with | List_Cons _ tt1 => foo_loop tt1 | List_Nil => Ok tt end +. + +(** [issue_270_loop_list::foo]: + Source: 'tests/src/issue-270-loop-list.rs', lines 8:0-16:1 *) +Definition foo (v : List_t (List_t u8)) : result unit := + match v with | List_Cons l t => foo_loop t | List_Nil => Ok tt end +. + +End Issue270LoopList. diff --git a/tests/fstar/misc/Issue270LoopList.fst b/tests/fstar/misc/Issue270LoopList.fst new file mode 100644 index 00000000..7b2ea351 --- /dev/null +++ b/tests/fstar/misc/Issue270LoopList.fst @@ -0,0 +1,23 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [issue_270_loop_list] *) +module Issue270LoopList +open Primitives + +#set-options "--z3rlimit 50 --fuel 1 --ifuel 1" + +(** [issue_270_loop_list::List] + Source: 'tests/src/issue-270-loop-list.rs', lines 2:0-5:1 *) +type list_t (t : Type0) = +| List_Cons : t -> list_t t -> list_t t +| List_Nil : list_t t + +(** [issue_270_loop_list::foo]: loop 0: + Source: 'tests/src/issue-270-loop-list.rs', lines 11:8-14:9 *) +let rec foo_loop (t : list_t (list_t u8)) : result unit = + begin match t with | List_Cons _ tt -> foo_loop tt | List_Nil -> Ok () end + +(** [issue_270_loop_list::foo]: + Source: 'tests/src/issue-270-loop-list.rs', lines 8:0-16:1 *) +let foo (v : list_t (list_t u8)) : result unit = + begin match v with | List_Cons l t -> foo_loop t | List_Nil -> Ok () end + diff --git a/tests/lean/Issue270LoopList.lean b/tests/lean/Issue270LoopList.lean new file mode 100644 index 00000000..8e9122ff --- /dev/null +++ b/tests/lean/Issue270LoopList.lean @@ -0,0 +1,31 @@ +-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS +-- [issue_270_loop_list] +import Base +open Primitives +set_option linter.dupNamespace false +set_option linter.hashCommand false +set_option linter.unusedVariables false + +namespace issue_270_loop_list + +/- [issue_270_loop_list::List] + Source: 'tests/src/issue-270-loop-list.rs', lines 2:0-5:1 -/ +inductive List (T : Type) := +| Cons : T → List T → List T +| Nil : List T + +/- [issue_270_loop_list::foo]: loop 0: + Source: 'tests/src/issue-270-loop-list.rs', lines 11:8-14:9 -/ +divergent def foo_loop (t : List (List U8)) : Result Unit := + match t with + | List.Cons _ tt => foo_loop tt + | List.Nil => Result.ok () + +/- [issue_270_loop_list::foo]: + Source: 'tests/src/issue-270-loop-list.rs', lines 8:0-16:1 -/ +def foo (v : List (List U8)) : Result Unit := + match v with + | List.Cons l t => foo_loop t + | List.Nil => Result.ok () + +end issue_270_loop_list diff --git a/tests/src/issue-270-loop-list.rs b/tests/src/issue-270-loop-list.rs new file mode 100644 index 00000000..b92f7630 --- /dev/null +++ b/tests/src/issue-270-loop-list.rs @@ -0,0 +1,16 @@ +//@ [coq,fstar] subdir=misc +pub enum List { + Cons(T, Box>), + Nil, +} + + +fn foo(v: &List>) { + if let List::Cons(_, t) = v { + let mut t = &**t; + while let List::Cons(_, tt) = t + { + t = &**tt; + } + } +}