impl should support parametric methods
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
**Describe the bug**
It seems that parametric impl methods currently fails to typecheck.
**To Reproduce**
```
impl Foo {
fn new(size: u3) -> Self {
Foo {
size
}
}
fn is_valid_p(self: Self) -> bool {
self.size <= MAX_SIZE
}
}
fn foo() -> u3 {
Foo::new(u3:0).size
}
#[test]
fn foo_is_valid_test() {
let foo3 = Foo::new(u3:3);
assert_eq(foo3.is_valid_p(), true);
assert_eq(foo3.is_valid_p(), false);
}
```
fails to typecheck with the following error:
```
TypeInferenceError: Cannot resolve callee `foo3.is_valid_p` to a function; XLS_RET_CHECK failure (xls/dslx/type_system/deduce_utils.cc:696) colon_ref != nullptr ((nil) vs. nullptr)
```
**Expected behavior**
`is_valid_p` is resolved as a parametric method.
Contributor guide
Assessment
This issue has not been assessed yet.