Demonstrate a couple simple_for_collect bugs

This commit is contained in:
Tom Jack 2019-12-04 13:34:20 -06:00 committed by Pierre-Emmanuel Wulfman
parent abfd561ffb
commit e262f9e103
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,20 @@
function shadowing_in_body (var nee : unit) : string is block {
var st : string := "";
var list1 : list(string) := list "to"; "to" end;
for x in list list1 block {
const x : string = "ta";
st := st ^ x;
}
} with st
(* should be "tata" *)
function shadowing_assigned_in_body (var nee : unit) : string is block {
var st : string := "";
var list1 : list(string) := list "to"; "to" end;
for x in list list1 block {
st := st ^ x;
var st : string := "ta";
st := st ^ x;
}
} with st
(* should be "toto" ??? *)

View File

@ -2253,6 +2253,17 @@ let no_semicolon_religo () : unit result =
in in
ok () ok ()
let loop_bugs_ligo () : unit result =
let%bind program = type_file "./contracts/loop_bugs.ligo" in
let input = e_unit () in
let%bind () =
let expected = e_string "tata" in
expect_eq program "shadowing_in_body" input expected in
let%bind () =
let expected = e_string "toto" in
expect_eq program "shadowing_assigned_in_body" input expected in
ok ()
let main = test_suite "Integration (End to End)" [ let main = test_suite "Integration (End to End)" [
test "bytes unpack" bytes_unpack ; test "bytes unpack" bytes_unpack ;
test "bytes unpack (mligo)" bytes_unpack_mligo ; test "bytes unpack (mligo)" bytes_unpack_mligo ;
@ -2421,4 +2432,5 @@ let main = test_suite "Integration (End to End)" [
test "tuple type (mligo)" tuple_type_mligo ; test "tuple type (mligo)" tuple_type_mligo ;
test "tuple type (religo)" tuple_type_religo ; test "tuple type (religo)" tuple_type_religo ;
test "no semicolon (religo)" no_semicolon_religo ; test "no semicolon (religo)" no_semicolon_religo ;
test "loop_bugs (ligo)" loop_bugs_ligo ;
] ]