google / google/xls

Duplicate proc name parse error refers to containing Module as `stdin`

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

Description

**Describe the bug**
Reusing a proc name (e.g. immediately following copy paste) will generate a formatter error that includes the filename, line info, and module. I'm pretty sure this is fairly recent, but now the module name is referred to as `stdin`, whereas before it would be the base filename ([example](https://github.com/google/xls/issues/1119#issue-1872025263) dug up from Github issues.

**To Reproduce**
```
proc foo_test {
config() { }

init { () }

next(_: ()) { }
}

proc foo_test {
config() { }

init { () }

next(_: ()) { }
}
```

Formatting failed: Error: INVALID_ARGUMENT: ParseError: test.x:10:13-10:18 Module `stdin` already contains a member named `foo_test.config` @ test.x:2:13-2:18
=== Source Location Trace: ===
xls/dslx/frontend/bindings.h:58
xls/dslx/frontend/parser.cc:2678
xls/dslx/frontend/parser.cc:472
xls/dslx/parse_and_typecheck.cc:71
xls/dslx/dslx_fmt.cc:91

**Expected behavior**
Don't refer to the module as `stdin`. Either reuse the base filename or remove it entirely until/if DSLX supports first class modules like Rust.

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.