[Bug]: IF node instead of IFLOOP when ternary operator in condition
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
When the expression in `while` contains ternary operator, slither creates IF instead of IFLOOP
### Code example to reproduce the issue:
```solidity
contract C {
function f() public {
bool a = true;
bool b = true;
bool c = true;
int i = 3;
while (a ? b : c) {
i++;
}
}
}
```
### Version:
0.9.3
(tested the freshest dev branch 3e390264a4903c522718b33478e5acb735f3e0e6)
### Relevant log output:
```shell
digraph{
0[label="Node Type: ENTRY_POINT 0
"];
0->1;
1[label="Node Type: NEW VARIABLE 1
EXPRESSION:
a = true
IRs:
a(bool) := True(bool)"];
1->2;
2[label="Node Type: NEW VARIABLE 2
EXPRESSION:
b = true
IRs:
b(bool) := True(bool)"];
2->3;
3[label="Node Type: NEW VARIABLE 3
EXPRESSION:
c = true
IRs:
c(bool) := True(bool)"];
3->4;
4[label="Node Type: NEW VARIABLE 4
EXPRESSION:
i = 3
IRs:
i(int256) := 3(int256)"];
4->5;
5[label="Node Type: BEGIN_LOOP 5
"];
5->9;
7[label="Node Type: EXPRESSION 7
EXPRESSION:
i ++
IRs:
TMP_0(int256) := i(int256)
i(int256) = i (c)+ 1"];
7->9;
8[label="Node Type: END_LOOP 8
"];
9[label="Node Type: IF 9
EXPRESSION:
a
IRs:
CONDITION a"];
9->10[label="True"];
9->11[label="False"];
10[label="Node Type: EXPRESSION 10
EXPRESSION:
b
"];
10->12;
11[label="Node Type: EXPRESSION 11
EXPRESSION:
c
"];
11->12;
12[label="Node Type: END_IF 12
"];
12->7;
12->8;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.