1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Add for loops

This commit is contained in:
Étienne Fildadut 2024-01-05 01:36:37 +01:00
parent a212dd7fd1
commit efb99a9ed7
28 changed files with 284 additions and 21 deletions

View file

@ -1,8 +1,8 @@
--# run #--
--- text ---
| {}"" {}"type(\"kg\", 5)" {}"" |
| {}"" {}"type(5, \"kg\")" {}"" |
--- text ---
| {}"" {}"type(\"kg\", 12)" {}"" |
| {}"" {}"type(12, \"kg\")" {}"" |
--- error ---
type check failure for weigh; 32 does not satisfy $(x) type(x) == t
↳ from test/tests/constrained variable assignement.ans:9:7 in assignment: weigh = 32

View file

@ -1,6 +1,6 @@
--# run #--
--- text ---
| {}"" {}"type(\"kg\", 5)" {}"" |
| {}"" {}"type(5, \"kg\")" {}"" |
--- text ---
| {}"" {}"12" {}"" |
--- return ---

View file

@ -5,7 +5,7 @@
--- text ---
| {}"" {}"42" {}"" |
--- error ---
identifier "z" is undefined in branch cf017f8a-7c86-4871-109af-6658231331e6
identifier "z" is undefined in branch 7dfcaa5b-2163-4f36-116ed-c4ab6bc8d28b
↳ from test/tests/exported variable nested.ans:12:3 in identifier: z
↳ from test/tests/exported variable nested.ans:12:1 in text interpolation: | {z} |
↳ from ? in block: :f = ($() _)…

View file

@ -0,0 +1,8 @@
--# run #--
--- text ---
| {}"" {}"1" {}"" |
| {}"" {}"2" {}"" |
--- return ---
()
--# saved #--
{}

View file

@ -0,0 +1,9 @@
--# run #--
--- text ---
| {}"" {}"1" {}"" |
| {}"" {}"2" {}"" |
| {}"" {}"4" {}"" |
--- return ---
()
--# saved #--
{}

View file

@ -0,0 +1,15 @@
--# run #--
--- error ---
can't call overload overload<($(table::($(x) <lua function>)) _), ($(tuple::($(x) type(x) == "tuple" | type(x) == "list")) _), ($(range::($(x) type(x) == t)) _), ($(s::($(x) <lua function>)) <lua function>)>: no function match (42), possible functions were:
• (table::($(x) <lua function>)): type check failure for parameter table in function (table::($(x) <lua function>))
• (tuple::($(x) type(x) == "tuple" | type(x) == "list")): type check failure for parameter tuple in function (tuple::($(x) type(x) == "tuple" | type(x) == "list"))
• (range::($(x) type(x) == t)): type check failure for parameter range in function (range::($(x) type(x) == t))
• (s::($(x) <lua function>)): type check failure for parameter s in function (s::($(x) <lua function>))
↳ from for.ans:3:18 in call: iter(var)
↳ from for.ans:3:12 in definition: :iterator = iter(var)
↳ from for.ans:2:1 in block: :iterator = iter(var)…
↳ from for.ans:2:68 in call: _
↳ from test/tests/for invalid iterator.ans:1:4 in call: for(:x, 42)
↳ from ? in block: for(:x, 42)…
--# saved #--
{}

10
test/results/for list.ans Normal file
View file

@ -0,0 +1,10 @@
--# run #--
--- text ---
| {}"" {}"7" {}"" |
| {}"" {}"96" {}"" |
| {}"" {}"a" {}"" |
| {}"" {}"3" {}"" |
--- return ---
()
--# saved #--
{}

View file

@ -0,0 +1,38 @@
--# run #--
--- text ---
| {}"-" |
| {}"" {}"1" {}"" |
| {}"" {}"2" {}"" |
| {}"" {}"3" {}"" |
| {}"" {}"4" {}"" |
| {}"" {}"5" {}"" |
--- text ---
| {}"-" |
| {}"" {}"2" {}"" |
| {}"" {}"3" {}"" |
| {}"" {}"4" {}"" |
| {}"" {}"5" {}"" |
| {}"" {}"6" {}"" |
| {}"" {}"7" {}"" |
--- text ---
| {}"-" |
| {}"" {}"2" {}"" |
| {}"" {}"5" {}"" |
--- text ---
| {}"-" |
| {}"" {}"4" {}"" |
| {}"" {}"3" {}"" |
| {}"" {}"2" {}"" |
| {}"" {}"1" {}"" |
| {}"" {}"0" {}"" |
--- text ---
| {}"-" |
--- text ---
| {}"-" |
--- text ---
| {}"-" |
| {}"" {}"4" {}"" |
--- return ---
()
--# saved #--
{}

View file

@ -0,0 +1,10 @@
--# run #--
--- text ---
| {}"" {}"true" |
| {}"" {}"true" |
| {}"" {}"true" |
| {}"" {}"true" |
--- return ---
()
--# saved #--
{}

View file

@ -0,0 +1,10 @@
--# run #--
--- text ---
| {}"" {}"true" |
| {}"" {}"true" |
| {}"" {}"true" |
| {}"" {}"true" |
--- return ---
()
--# saved #--
{}

View file

@ -0,0 +1,11 @@
--# run #--
--- text ---
| {}"" {}"2" {}"" |
| {}"" {}"5" {}"" |
| {}"" {}"7" {}"" |
| {}"" {}"1" {}"" |
| {}"" {}"8" {}"" |
--- return ---
()
--# saved #--
{}

View file

@ -4,7 +4,7 @@
--- text ---
| {}"" {}"idk" {}" is esperanto" |
--- error ---
can't call overload overload<($(name::($(x) type(x) == t)) _), ($(name::($(x) type(x) == t)) _)>: no function match (type("nope", 5)), possible functions were:
can't call overload overload<($(name::($(x) type(x) == t)) _), ($(name::($(x) type(x) == t)) _)>: no function match (type(5, "nope")), possible functions were:
• (name::($(x) type(x) == t)): type check failure for parameter name in function (name::($(x) type(x) == t))
• (name::($(x) type(x) == t)): type check failure for parameter name in function (name::($(x) type(x) == t))
↳ from test/tests/function custom type dispatch error.ans:14:2 in call: a(type(5, "nope"))

View file

@ -1,15 +1,15 @@
--# run #--
--- text ---
| {}"c" |
--- text ---
| {}"b" |
--- text ---
| {}"a" |
--- text ---
| {}"b" |
| {}"c" |
--- text ---
| {}"b" |
| {}"a" |
--- text ---
| {}"a" |
--- text ---
| {}"c" |
--- return ---
()
--# saved #--
{"a.checkpoint":false, "a.run":1, "b.checkpoint":false, "b.run":3, "c.checkpoint":false, "c.run":1}
{"a.checkpoint":false, "a.run":3, "c.checkpoint":false, "c.run":2}

View file

@ -1,6 +1,6 @@
--# run #--
--- error ---
identifier "b" is undefined in branch cf017f8a-7c86-4871-109af-6658231331e6
identifier "b" is undefined in branch 7dfcaa5b-2163-4f36-116ed-c4ab6bc8d28b
↳ from test/tests/function scope wrong.ans:4:7 in identifier: b
↳ from test/tests/function scope wrong.ans:4:1 in text interpolation: | a: {b} |
↳ from ? in block: :a = ($() _)…