forked from ground/ground
Ints are autotransformed to doubles where needed
This commit is contained in:
@@ -2368,8 +2368,12 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
|
|||||||
|
|
||||||
// Type checking - now with error reporting
|
// Type checking - now with error reporting
|
||||||
if (arg.type != getLitType(fnArgs[m])) {
|
if (arg.type != getLitType(fnArgs[m])) {
|
||||||
return error("Function " + ref.fnName + " argument " + to_string(m + 1) +
|
if (arg.type == Types::Double && getLitType(fnArgs[m]) == Types::Int) {
|
||||||
" type mismatch. Expected type does not match provided argument type.", "typeError");
|
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
|
// Create the variable
|
||||||
|
|||||||
Reference in New Issue
Block a user