google / google/xls

formatter (and parser?) ambiguity with nested parameteric function invocation

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

Description

**Describe the bug**

It seems that the formatter (and possibly) the parser have issues resolving the ambiguities w/ nested parametrics function invocation.

**To Reproduce**

I've seen it w/ `assert_eq`, ex:
```
assert_eq(function_name(some_param, another_param), some_expected_result);
```

That get formatted as:
```
assert_eq(
function_name < SOME_CONST, some_module::SOME_CONST_STRUCT.some_field > (some_param, another_param),
some_expected_result);
```
and treat the parametric function invocation as 3 parameters to `assert_eq`
- `function_name < SOME_CONST`: comparison between two scalar
- `some_module::SOME_CONST_STRUCT.some_field > (some_param, another_param)`: comparison between a scalar and a tuple
- `some_expected_result`

The interpreter also throw:
```
`function_name` is parametric function, but it is not being invoked
```
or
```
TypeInferenceError: Cannot use operator `<` on functions
```

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.