-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Support deriving Print for enums #1091
Conversation
for implementation i am thinking of using this #[derive(Print, Copy, Drop, Serde)]
enum Enemy {
Unknown,
Bot: felt252,
OtherPlayer: ContractAddress,
} are there any more complicated type that we might need to support? Struct variant doesn't seem to test for user type so i am not considering that here as well. cc: @tarrencev |
2416546
to
bf5c787
Compare
@0xicosahedron thanks for the work here. ideally we do support user defined types but happy to follow up with that PR. do you mind adding a test here: https://github.com/dojoengine/dojo/blob/main/crates/dojo-lang/src/plugin_test_data/print |
bf5c787
to
415d88d
Compare
for the above enum does this pseudocode implementation makes sense? for variants with no value its not an issue. but for variants that contain other types i need to figure out someway to get that type information.
is there any good documentation on |
415d88d
to
564d4a2
Compare
figured it out |
review please @tarrencev |
i think this PR should already support user defined type if they itself derive |
Minor feedback otherwise lgtm |
@tarrencev actually i am confused. In the test In the test we verify the |
so i am not sure if even deriving |
for context this change was made in #1090 |
closing as was merged |
@ponderingdemocritus i am confused, what was merged? |
bump |
2ad5f6f
to
e7a96dd
Compare
@glihm check this comment: I will get time to work on this tomorrow, will see if its still the case. |
Yup, but not sure to follow, everything seems normal here. In the Or I misunderstood you sorry. |
91499e9
to
02fcac3
Compare
@glihm So in
In the test we only check the I am not sure why we don't see methods from You can check this by completely removing dojo/crates/dojo-lang/src/plugin_test.rs Lines 113 to 119 in 3c55d86
Does it make sense now? |
03f2793
to
c77b555
Compare
Did you run the command I mentioned in my previous comment here? You should be all good once you run it. |
okay merged with main and ran the command you provided it updated few class hash. |
okay just realized why the tests where failing, i overrode the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1091 +/- ##
==========================================
- Coverage 67.62% 67.62% -0.01%
==========================================
Files 218 218
Lines 21054 21047 -7
==========================================
- Hits 14238 14233 -5
+ Misses 6816 6814 -2 ☔ View full report in Codecov by Sentry. |
Thank you for all this follow up. The reason why the code of the test is not generated is because it can't compile. You can leverage the |
okay will take a look soon, thanks! |
@glihm even after doing this changes and running the command you provided it didn't update the test files. can you let me know how did you figure out that compilation is failing, so i can see the error locally? |
Sorry it was my fault, I didn't update correctly the
I tested with a real project, compiling with Just pushed the update + refacto the plugin test at the same occasion. You're doing good, thanks to your comment I was able to identify the problem. |
thank you sir! |
Fix: #1084