feat: add type checker for unsigned integers#336
feat: add type checker for unsigned integers#336Darxo wants to merge 2 commits intoMSUTeam:developmentfrom
Conversation
7e4e034 to
e785dae
Compare
| { | ||
| if (value < 0) | ||
| { | ||
| ::logError(value + " must have the type: unsigned"); |
There was a problem hiding this comment.
I'd argue unsigned isn't actually a type and therefore the error should be something more like.
value + " must have the type: integer, and be greater than or equal to 0"
There was a problem hiding this comment.
In that same vein what about the function name? Should it be something like requireUInt?
|
Hm, it's not really an uint; maybe just call it "requirePositive"? |
msu/utils/type_checkers.nut
Outdated
|
|
||
| ::MSU.requireUnsigned <- function( ... ) | ||
| { | ||
| ::MSU.requireTypeArray("integer", vargv); |
There was a problem hiding this comment.
I will say this use of the existing require check only seemed good back then.
But in reality this means that failing an unsigned integer check will print a "failed an integer check" message half the time. And that is not fully correct.
Ideally we would copy&paste the integer check logic in this check but swap out the printed exception
6677ac8 to
ae825b7
Compare
Closes: #335