forked from ground/ground
Ints are autotransformed to doubles where needed
This commit is contained in:
@@ -2368,9 +2368,13 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
|
||||
|
||||
// Type checking - now with error reporting
|
||||
if (arg.type != getLitType(fnArgs[m])) {
|
||||
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
|
||||
variables[arg.ref.varName] = fnArgs[m];
|
||||
|
||||
Reference in New Issue
Block a user