urlyy commented on code in PR #2798:
URL: https://github.com/apache/fory/pull/2798#discussion_r2450660577


##########
rust/fory-derive/src/object/util.rs:
##########
@@ -394,7 +394,13 @@ pub(super) fn generic_tree_to_tokens(node: &TypeNode) -> 
TokenStream {
         ts
     } else {
         quote! {
-            <#ty as 
fory_core::serializer::Serializer>::fory_get_type_id(type_resolver)?
+            match <#ty as 
fory_core::serializer::Serializer>::fory_get_type_id(type_resolver) {
+                Ok(id) => id,
+                Err(_) => {
+                    type_resolver.do_register(std::any::TypeId::of::<#ty>())?;

Review Comment:
   If the field type is registered after the struct type, then it enters `Err` 
here and immediately registers the field type, then `retry` once to obtain the 
field's type_id.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to