google / google/xls

let-bindings don't work with impl methods

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

Description

Consider the following:

```
pub struct A { x: u32 }
pub impl A {
pub fn dump(self: Self) -> u32 { self.x }
}

pub fn main(a: A) -> u32 {
let to_dump = a.dump();
to_dump
}
```

This should typecheck, and it does if main instead directly returns `a.dump()` instead of binding to an intermediate. However, running `interpreter_main` gives a `BytecodeEmitter could not find slot or binding for name` error.

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.