You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
globalA_GLOBAL = 3;
structWeirdStruct<T, U> {
a: T,
b: U,
}
#[mangle_fn]
fnmy_fn() -> [u8; A_GLOBAL] {
[0; A_GLOBAL]
}
comptimefnmangle_fn(f: FunctionDefinition) {
letreturn_type = f.return_type();
// I have to construct this as a quoted value for my use case, cannot use the type directlyletgenerics = f"Field,{return_type}".quoted_contents();
// This prints the faulty type <Field,[u8; (3: numeric Field)]>println(generics);
letnew_return_type = quote { WeirdStruct<$generics>}.as_type();
letnew_body = quote {
{
WeirdStruct { a: 1, b: [0;3] }
}
}.as_expr().unwrap();
f.set_return_type(new_return_type);
f.set_body(new_body);
}
Expected Behavior
The above example should compile
Bug
error: Failed to parse macro's token stream into a type
┌─ src/main.nr:19:27
│
19 │ let new_return_type = quote { WeirdStruct<$generics>}.as_type();
│ -------------------------------
│ │
│ Unexpected UnquoteMarker(ExprId(Index(44777))), expected one of bool, crate, CtString, dep, Expr, Field, fn, fmtstr, FunctionDefinition, impl, Module, Quoted, str, StructDefinition, super, TopLevelItem, TraitConstraint, TraitDefinition, TraitImpl, TypedExpr, Type, unconstrained, UnresolvedType, <, &, (, [, integer type, type expression, Ident, QuotedType, InternedUnresolvedTypeData
# Description
## Problem\*
Resolves#6077
## Summary\*
The change made to `impl Debug for Type` to display kinds differently
was breaking the use case of formatting types into a format string then
using `.quoted_contents()` to quote the contents of the string.
## Additional Context
## Documentation\*
Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.
# PR Checklist\*
- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Aim
Use array types in quoted values
Expected Behavior
The above example should compile
Bug
To Reproduce
Use the example
Workaround
Yes
Workaround Description
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
No response
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: