google / google/xls

Allow auto literals for indices to `update` and`array_slice`

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

Description

### What's hard to do? (limit 100 words)

Discussed in review of https://github.com/google/xls/pull/3814, it feels like we should be able to write stuff like:

`update(my_array, 1, val)`.

With the above change, you now must specify `update(my_array, u32:1, val)` to avoid errors like:

```
TypeInferenceError: Could not infer parametric(s): N of function `array_slice`
```

### Current best alternative workaround (limit 100 words)

Explicitly annotate the index.

### Your view of the "best case XLS enhancement" (limit 100 words)

The literal should be promoted to a sensible type, maybe `u32` for now, since that's what we use for parametrics.

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.