The same warning is reported multiple times in parametrized functions
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
Consider the following function that has a style violation of using a lower case `bar` instead of upper case `BAR` and the test which instantiates multiple versions of this function with different parameters:
```rust
pub fn foo(x: uN[WIDTH]) -> uN[WIDTH] {
const bar = uN[WIDTH]:42;
x + bar
}
#[test]
fn test_foo() {
// Instantiate with different types
assert_eq(foo(u7:2), u7:44);
assert_eq(foo(u8:5), u8:47);
assert_eq(foo(u9:100), u9:142);
}
```
## What is ...
Running the tests now emits the very same warning at the same line of code with the same message, possibly due to being internally instantiated multiple times with different parameters. However, the output is exactly the same.
```
bazel run //xls/dslx:interpreter_main -- /tmp/foo.x
/tmp/foo.x:2:3-2:28
0001: pub fn foo(x: uN[WIDTH]) -> uN[WIDTH] {
0002: const bar = uN[WIDTH]:42;
~~~~~~~~^-----------------------^ Standard style is SCREAMING_SNAKE_CASE for constant identifiers; got: `bar`
0003: x + bar
0004: }
/tmp/foo.x:2:3-2:28
0001: pub fn foo(x: uN[WIDTH]) -> uN[WIDTH] {
0002: const bar = uN[WIDTH]:42;
~~~~~~~~^-----------------------^ Standard style is SCREAMING_SNAKE_CASE for constant identifiers; got: `bar`
0003: x + bar
0004: }
/tmp/foo.x:2:3-2:28
0001: pub fn foo(x: uN[WIDTH]) -> uN[WIDTH] {
0002: const bar = uN[WIDTH]:42;
~~~~~~~~^-----------------------^ Standard style is SCREAMING_SNAKE_CASE for constant identifiers; got: `bar`
0003: x + bar
0004: }
```
The same multitude of messages is also emitted in the language server...
## ... what should
These messages should be uniqified and only emitted once as it is exactly the same position and exactly the same error text.
Contributor guide
Assessment
This issue has not been assessed yet.