Ints are autotransformed to doubles where needed

This commit is contained in:
2025-09-21 14:29:59 +10:00
parent c4ebca9ed9
commit c0a7698497

View File

@@ -2368,8 +2368,12 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
// Type checking - now with error reporting
if (arg.type != getLitType(fnArgs[m])) {
return error("Function " + ref.fnName + " argument " + to_string(m + 1) +
" type mismatch. Expected type does not match provided argument type.", "typeError");
if (arg.type == Types::Double && getLitType(fnArgs[m]) == Types::Int) {
fnArgs[m].val = double(get<int>(fnArgs[m].val));
} else {
return error("Function " + ref.fnName + " argument " + to_string(m + 1) +
" type mismatch. Expected type does not match provided argument type.", "typeError");
}
}
// Create the variable