[Feature/bug] String variables can be used as integers if they are integers, but doubles can't.
LadyCailinBot opened this issue ยท 3 comments
Comment by PseudoKnight
This could be fixed if we changed ArgumentValidation.anyDoubles() from
if(c1 instanceof CDouble) {
to
if(c1 instanceof CDouble || c1 instanceof CString && c1.val().indexOf(".", 1) > -1) {
This won't affect any existing Java or mscript that I can think of, and it would allow arguments passed in by alias to be considered doubles even when they weren't casted -- more forgiving. I think this is appropriate since we're in ArgumentValidation here, which is usually used for this sort of thing. indexOf() is used here instead of full double evaluation since it's going to throw an exception later anyway if it's invalid. It would add small amount of overhead when not adding CDoubles. There might be something I haven't thought of, but I think this might be worth doing.