arocc icon indicating copy to clipboard operation
arocc copied to clipboard

Add protection from calling `typeStr` with an invalid type

Open ehaas opened this issue 2 years ago • 2 comments

This checks before calling typeStr with the places that I could generate a crash, and adds a check for non-debug modes so that they'll return an obvious error instead of illegal behavior.

ehaas avatar Dec 14 '23 08:12 ehaas

Closes #585

ehaas avatar Dec 14 '23 08:12 ehaas

There are no tests because you need lots of errors in the first place to generate these crashes and I don't think the messages themselves would be very useful. I tested manually by making a builtin with a return type of .invalid and doing various operations on the returned value.

ehaas avatar Dec 14 '23 08:12 ehaas

Sorry to make you check all potential places where this could happen but seeing the change now I agree that it'd be better to just check the type in typeStr and return an error.

Vexu avatar Feb 07 '24 13:02 Vexu