google / google/xls

[DSLX:TIv2] Overshifts should be allowed for parameterized types

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

Description

If we make a parameterized routine, and do something like:

```
fn f(x: uN[N]) -> uN[N] {
(x >> 4) + x
}
```

with the current TIv2 warnings we'll flag an overshift if `N <=3`, but this routine is mathematically ok in that range, so it seems like an overly aggressive thing to flag. I think ideally we either:

* limit this warning to when it's a concrete (non-parameterized) type shifted by a literal (non parameter, perhaps context-independent `const` is also ok) amount
* give some pragma for opting an expression out

the latter means that routines aren't truly generic without source modification, so I think that's both less desirable and more work, so I'd like to restrict the warning to the former.

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.