Commit e6b92db
authored
[OpenQASM]: Properly detect zero step in const ranges (#2715)
We were trying to detect if a step in a const range was zero by manually
inspecting the `step` expression before being const evaluated. This only
works if the `step` expr is the `0` literal, but it won't work if it is
a const-expression evaluating to zero. This PR changes that logic to
check the `step` value after being const-evaluated.
Fixes #27021 parent e428ee9 commit e6b92db
File tree
3 files changed
+34
-2
lines changed- source/compiler/qsc_qasm/src
- semantic
- tests
- expression
3 files changed
+34
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4589 | 4589 | | |
4590 | 4590 | | |
4591 | 4591 | | |
4592 | | - | |
4593 | | - | |
| 4592 | + | |
| 4593 | + | |
4594 | 4594 | | |
4595 | 4595 | | |
4596 | 4596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
0 commit comments