Closed vuvoth closed 1 week ago
This simplifies the code a lot, thanks! But can we just use function instead of macro to achieve the same?
This simplifies the code a lot, thanks! But can we just use function instead of macro to achieve the same?
We can. However, we need create the function warps this function with #[test] macros for every test.
Hmm, yeah. But I think it is fine to use #[test] as it is a common practice for testing, and it is more explicit for code reading.
We are trying to avoid creating custom macros as much as possible, since they are generally harder to comprehend.
Got it! So I will update PR. Btw I'm planing to add more tests for packages.
Hi @katat! We can't pass something like ErrorKind::ReturnTypeMismatch(..) to function params. I also think the macro is not so hard to read in this case.
I agree with @katat here that macros should be sort of used as last case resort as they're hard to maintain/update, I don't think the changes are impactful enough here to warrant the introduction of a macro
Hey @mimoo, @katat! Please review my PR again!
Thanks!
I have two comments:
Can we remove the error stack trace if the test passes? I think these error logs is confusing especially when the tests pass.
It should be more appropriate to have these sort of tests in the type_checker/mod.rs
, as it is testing the type checking.
closing for now, feel free to reopen
Changes