google / google/xls

dslx should deduce function parametric from type of lhs of assignment expression

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

Description

It would be nice if dslx could deduce parametric function params from the type of left-hand, like in:
```
fn foo() -> uN[SZ] {
uN[SZ]:42
}
#[test]
fn foo_test() {
let foo42: u8 = foo();
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ TypeInferenceError: uN[SZ] Instantiated return type did not have all parametrics resolved.
assert_eq(foo42, u8:42);
}
```

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.