google / google/xls

Confusing parse error about test_proc impl

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

Description

**Describe the bug**
The parser/formatter provides an error explaining that impls are not supported in test procs, even though that's not related to the actual issue.

**To Reproduce**
```
#[test_proc]
proc foo_test { }
```

Formatting failed: Error: INVALID_ARGUMENT: ParseError:test.x:1:13-2:18 Test proc with impl is not yet supported at test.x:1:13-2:18
=== Source Location Trace: ===
xls/dslx/frontend/bindings.h:58
xls/dslx/frontend/parser.cc:416
xls/dslx/parse_and_typecheck.cc:71
xls/dslx/dslx_fmt.cc:91

**Expected behavior**
I expect the real issue to be that config/init/next are not defined. The correct error is provided when specifying at least one of these:

```
#[test_proc]
proc foo_test {

config() {}

}
```

Formatting failed: Error: INVALID_ARGUMENT: ParseError: test.x:2:1-6:2 Procs must define `init`, `config` and `next` functions; missing: `init`, `next`.
=== Source Location Trace: ===
xls/dslx/frontend/bindings.h:58
xls/dslx/frontend/parser.cc:3557
xls/dslx/frontend/parser.cc:416
xls/dslx/parse_and_typecheck.cc:71
xls/dslx/dslx_fmt.cc:91

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.