Closed olegrok closed 3 years ago
23be8480e153521772adf6317f04c7d03c65a67c is weird: it does not explain why to use such hacky way to validate a value. Better for JIT? Observed better performance?
The code version before 23be8480e153521772adf6317f04c7d03c65a67c is easier to understand and now we anyway check the type explicitly. Maybe it would be logical to just revert the commit. However I don't mind your minimal change.
At least is solved the observed problem and does not lead to any visible functional degradation.
Since 23be848 (Validate/long: final rewrite) "long" type validation started to handle string representation of numbers. This happens because "tonumber" function implicitly casts some strings to numbers. That allows to pass strings (e.g. "123") instead of "long".
This patch fixes such behaviour and introduces corresponding test. Currently we will try to cast to number only fields that have "number" or "cdata" type.
Closes #133