urlyy commented on code in PR #2492:
URL: https://github.com/apache/fory/pull/2492#discussion_r2297620921
##########
rust/tests/tests/test_complex_struct.rs:
##########
@@ -17,36 +17,36 @@
use chrono::{DateTime, NaiveDate, NaiveDateTime};
use fory_core::fory::Fory;
-use fory_core::types::Mode;
use fory_derive::Fory;
-use std::any::Any;
+// use std::any::Any;
use std::collections::HashMap;
-#[test]
-fn any() {
- #[derive(Fory, Debug)]
- struct Animal {
- f3: String,
- }
-
- #[derive(Fory, Debug)]
- struct Person {
- f1: Box<dyn Any>,
- }
-
- let person = Person {
- f1: Box::new(Animal {
- f3: String::from("hello"),
- }),
- };
-
- let mut fory = Fory::default();
- fory.register::<Animal>(999);
- fory.register::<Person>(1000);
- let bin = fory.serialize(&person);
- let obj: Person = fory.deserialize(&bin).expect("");
- assert!(obj.f1.is::<Animal>())
-}
+// RUSTFLAGS="-Awarnings" cargo expand -p fory-tests --test test_complex_struct
Review Comment:
现在宏在两种Compatible
Mode下都会基于struct的field进行宏展开,并由于宏中生成FieldType的操作对某些结构体(比如Box\<dyn
any\>)不适用,导致一些原本在consistent下能正常运行的se/deserialize单元测试,会因为宏展开后的代码报错而无法继续执行。
--
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]