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

[language] Add multiple assignments, assignment and definitions are now function calls

This commit is contained in:
Étienne Fildadut 2024-01-11 01:34:20 +01:00
parent 760181eaf9
commit b6473de4d2
36 changed files with 180 additions and 172 deletions

View file

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

View file

@ -1,7 +1,7 @@
--# run #--
--- error ---
trying to change the value of constant a
↳ from test/tests/constant variable.ans:5:3 in assignment: a = 52
↳ from test/tests/constant variable.ans:5:3 in call: a = 52
↳ from ? in block: ::a = 3…
--# saved #--
{}

View file

@ -5,7 +5,7 @@
| {}"" {}"type(12, \"kg\")" {}"" |
--- error ---
value 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
↳ from test/tests/constrained variable assignement.ans:9:7 in call: weigh = 32
↳ from ? in block: :weigh::is("kg") = type(5, "kg")…
--# saved #--
{}

View file

@ -1,7 +1,7 @@
--# run #--
--- error ---
a is already defined in the current scope
↳ from test/tests/define override function.ans:4:4 in definition: :a = 2
↳ from test/tests/define override function.ans:4:4 in call: :a = 2
↳ from ? in block: :a = ($() _)…
--# saved #--
{}

View file

@ -1,7 +1,7 @@
--# run #--
--- error ---
can't add an overload variant to non-overloadable variable a defined in the same scope
↳ from test/tests/define override variable.ans:3:1 in definition: :a = ($() _)
↳ from test/tests/define override variable.ans:3:1 in call: :a = ($() _)
↳ from ? in block: :a = 2…
--# saved #--
{}

View file

@ -1,7 +1,7 @@
--# run #--
--- error ---
a is already defined in the current scope
↳ from test/tests/define override.ans:3:4 in definition: :a = 2
↳ from test/tests/define override.ans:3:4 in call: :a = 2
↳ from ? in block: :a = 5…
--# saved #--
{}

View file

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

View file

@ -10,7 +10,7 @@
• $(s::is struct) (from stdlib/for.ans:2:1):
value check failure for parameter s
↳ from stdlib/for.ans:3:18 in call: iter(var)
↳ from stdlib/for.ans:3:12 in definition: :iterator = iter(var)
↳ from stdlib/for.ans:3:12 in call: :iterator = iter(var)
↳ from stdlib/for.ans:2:1 in block: :iterator = iter(var)…
↳ from stdlib/for.ans:2:71 in call: _
↳ from test/tests/for invalid iterator.ans:1:4 in call: for(:x, 42)

View file

@ -1,7 +1,7 @@
--# run #--
--- error ---
a function with parameters $(a, b) is already defined in the overload
↳ from test/tests/function conflict.ans:5:1 in definition: :f = ($(a, b) 0)
↳ from test/tests/function conflict.ans:5:1 in call: :f = ($(a, b) 0)
↳ from ? in block: :f = ($(a, b) 0)…
--# saved #--
{}

View file

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

View file

@ -6,7 +6,7 @@
| {}"d=" {}"2" {}" (2)" |
--- error ---
trying to change the value of constant d
↳ from test/tests/symbol alias constant.ans:12:3 in assignment: d = 5
↳ from test/tests/symbol alias constant.ans:12:3 in call: d = 5
↳ from ? in block: :l = *[1, 2, 3]…
--# saved #--
{}