google / google/xls

DSLX: A for loop with non-const upper bound

Open
#405 2 comments 0 reactions 0 assignees View on GitHub
long-term-enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Hello!
If in the DSL file in the for loop, if I specify not a constant but a variable in the upper bound of the range, then the interpreter get the message:

```rust
#![test]
fn test_for()
{
let a = u8:3;
// const a = u8:3;
let _ = for (i, acc) : (u8, u8) in range (u8:0, a)
{
acc + i
}(u8:0);
()
}
```

```bash
$ /interpreter_main /test_for.x

E0422 08:51:22.003500 6664 command_line_utils.cc:35] Could not extract a textual position from error message: NOT_FOUND: Could not find bindings entry for identifier: "a" @ /test_for.x:6:53-6:54: INVALID_ARGUMENT: Provided status is not in recognized error form: NOT_FOUND: Could not find bindings entry for identifier: "a" @ /test_for.x:6:53-6:54
F0422 08:51:22.003547 6664 interpreter_main.cc:147] Check failed: ::absl::OkStatus() == (status) (OK vs. NOT_FOUND: Could not find bindings entry for identifier: "a" @ /test_for.x:6:53-6:54)
```

If you specify a constant, it goes fine.
Please, is there any workaround to use the variable?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.