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

[language] replace constant symbols with a constant value check function

This commit is contained in:
Étienne Fildadut 2024-04-24 16:15:58 +02:00
parent b534a3c4a2
commit aaff625b6c
15 changed files with 31 additions and 37 deletions

View file

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

View file

@ -4,7 +4,7 @@
--- text ---
| {}"" {}"type(12, \"kg\")" {}"" |
--- error ---
value check failure for weigh; 32 does not satisfy $(x) type(x) == t
can not set weigh = 32; $(x) type(x) == t value check failed
↳ from test/tests/constrained variable assignement.ans:9:7 in call: weigh = 32
↳ from test/tests/constrained variable assignement.ans:1:1 in block: :weigh::is("kg") = type(5, "kg")…
--# saved #--

View file

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

View file

@ -1,4 +1,4 @@
::a = *[3]
:a::constant = *[3]
|{a}

View file

@ -1,4 +1,4 @@
::a = 3
:a::constant = 3
{a}

View file

@ -1,4 +1,4 @@
::a = [1:2]
:a::constant = [1:2]
|false = {a == [5:2]}
@ -6,7 +6,7 @@
|true = {a == [1:2]}
::b = [1,2,3]
:b::constant = [1,2,3]
|false = {b == a}
@ -24,6 +24,6 @@
|true = {c!to tuple == b}
::d = [1,2,3]
:d::constant = [1,2,3]
|true = {d == b}

View file

@ -1,11 +1,11 @@
:l = *[1,2,3]
::&c => l(2)
:&c::constant => l(2)
| c={c} (2)
| l={l} (*[1,2,3])
::&d = "{l(2)}"
:&d::constant = "{l(2)}"
| d={c} (2)