It seems that the intention of buzzobj_cmp in src/buzz/buzztype.c is to make comparisons between certain types illegal. For example, there is code for comparisons between 2 userdata, but not for userdata and other types, so it could be reasoned userdata can only be compared between themselves. This is not the case however (for example, they can be compard with nil).
This does not cause any error at the moment, because these other comparisons are handled implicitly by logic which is executed before in the code. However, some bugs could be introduced if the order of comparisons were changed.
This is highlighted by TEST(BuzzObjCompare, IncompatibleTypes) in src/testing/unittest/buzztype_test.cpp (instructions on how to run the tests are provided in src/testing/unittest/README.md), where the comparison between nil and a userdata should cause an error, but it doesn't.
The solution for this is likely a refactor of the function.
It seems that the intention of buzzobj_cmp in src/buzz/buzztype.c is to make comparisons between certain types illegal. For example, there is code for comparisons between 2 userdata, but not for userdata and other types, so it could be reasoned userdata can only be compared between themselves. This is not the case however (for example, they can be compard with nil).
This does not cause any error at the moment, because these other comparisons are handled implicitly by logic which is executed before in the code. However, some bugs could be introduced if the order of comparisons were changed.
This is highlighted by TEST(BuzzObjCompare, IncompatibleTypes) in src/testing/unittest/buzztype_test.cpp (instructions on how to run the tests are provided in src/testing/unittest/README.md), where the comparison between nil and a userdata should cause an error, but it doesn't.
The solution for this is likely a refactor of the function.