introduce if-else expression, implement case in propagation when consequence and alternative are equal, adjust tests
This commit is contained in:
parent
0764a64a61
commit
ef4484f7ef
2 changed files with 61 additions and 0 deletions
|
@ -0,0 +1,10 @@
|
|||
def throwing_bound<N>(u32 x) -> u32:
|
||||
assert(x == N)
|
||||
return 1
|
||||
|
||||
// this compiles: the conditional, even though it can throw, has a constant compile-time value of `1`
|
||||
// However, the assertions are still checked at runtime, which leads to panics without branch isolation.
|
||||
def main(u32 x):
|
||||
for u32 i in 0..if x == 0 then throwing_bound::<0>(x) else throwing_bound::<1>(x) fi do
|
||||
endfor
|
||||
return
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"entry_point": "./tests/tests/panics/conditional_bound_throw.zok",
|
||||
"curves": ["Bn128"],
|
||||
"tests": [
|
||||
{
|
||||
"input": {
|
||||
"values": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"Err": {
|
||||
"UnsatisfiedConstraint": {
|
||||
"left": "0",
|
||||
"right": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"values": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"Err": {
|
||||
"UnsatisfiedConstraint": {
|
||||
"left": "1",
|
||||
"right": "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"values": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"Err": {
|
||||
"UnsatisfiedConstraint": {
|
||||
"left": "2",
|
||||
"right": "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue