Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
proppy opened this issue Mar 6, 2025 · 1 comment
Labels
bug Something isn't working or is incorrect dslx:fmt DSLX auto-formatter dslx DSLX (domain specific language) implementation / front-end 🧦 sox

Comments

@proppy
Copy link
Member

proppy commented Mar 6, 2025

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_CONST, some_module::SOME_CONST_STRUCT.some_field>(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
@proppy proppy added bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end dslx:fmt DSLX auto-formatter labels Mar 6, 2025
@proppy proppy added the 🧦 sox label Mar 6, 2025
@proppy
Copy link
Member Author

proppy commented Mar 6, 2025

Note that assigning some_module::SOME_CONST_STRUCT.some_field to an intermediate const binding seems to workaround the ambiguity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or is incorrect dslx:fmt DSLX auto-formatter dslx DSLX (domain specific language) implementation / front-end 🧦 sox
Projects
Status: No status
Development

No branches or pull requests

1 participant