In this PR https://github.com/noir-lang/noir/pull/1952 format strings are being added to enable easy string interpolation for printing. During name resolution a string literal is checked for identifiers and compared in the most recent scope.
When converting these identifiers to expressions we check the definition info of each ident to fetch an expression. However, for function parameters an identifiers expression is not stored as its definition. This leads to this panic:
Message: ICE: format string field requires expression
Location: crates/noirc_frontend/src/monomorphization/mod.rs:268
Problem
In this PR https://github.com/noir-lang/noir/pull/1952 format strings are being added to enable easy string interpolation for printing. During name resolution a string literal is checked for identifiers and compared in the most recent scope.
When converting these identifiers to expressions we check the definition info of each ident to fetch an expression. However, for function parameters an identifiers expression is not stored as its definition. This leads to this panic:
when attempting to do something like this:
This requires having to set function parameters to intermediate variables before printing them.
Happy Case
We should be able to print function parameters like any other identifier.
Alternatives Considered
N/A
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response