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
usestd::meta::typ::fresh_type_variable;
pubcomptimefnstorage(s: StructDefinition) ->Quoted {
println("STORAGE");
let (field_name, stored_type) = s.fields()[0];
letany = fresh_type_variable();
letmaybe_serialize_impl = stored_type.get_trait_impl(quote { crate::traits::Serialize<$any> }.as_trait_constraint());
assert(
maybe_serialize_impl.is_some(), f"Attempted to fetch serialization length, but {stored_type} does not implement the Serialize trait"
);
letserialize_impl = maybe_serialize_impl.unwrap();
letsize = serialize_impl.trait_generic_args()[0].as_constant().unwrap();
// Hoping for 5println(f"SERIALIZED_SIZE {size}");
letname = s.name();
quote {
impl $name {
fninit() ->Self {
Self {
$field_name: $stored_type::create()
}
}
}
}
}
It should be possible to find the derived Serialize implementation
Expected Behavior
The above should compile
Bug
Fails with
error: Attempted to fetch serialization length, but State does not implement the Serialize trait
┌─ src/meta/mod.nr:10:9
│
10 │ maybe_serialize_impl.is_some(), f"Attempted to fetch serialization length, but {stored_type} does not implement the Serialize trait"
│ ------------------------------ Assertion failed
│
= Call stack:
1. src/main.nr:24:7
To Reproduce
Use the above example
Workaround
None
Workaround Description
No response
Additional Context
I've checked is not an order issue, since the derive annotation runs before storage. Also using .implements and then checking the any variable to be bound to the length doesn't work either, fails with the same error.
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:
Aim
Given:
If I have a storage annotation like this:
It should be possible to find the derived Serialize implementation
Expected Behavior
The above should compile
Bug
Fails with
To Reproduce
Use the above example
Workaround
None
Workaround Description
No response
Additional Context
I've checked is not an order issue, since the
derive
annotation runs beforestorage
. Also using.implements
and then checking theany
variable to be bound to the length doesn't work either, fails with the same error.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: