Opened 14 years ago

Last modified 14 years ago

#1310 closed defect (fixed)

Error messages when calling functions with too few arguments

Reported by: Martin Sjölund Owned by: Martin Sjölund
Priority: high Milestone:
Component: Version:
Keywords: Cc: Martin Sjölund,

Description

{{{public function unparseStr
"function: unparseStr

Prettyprints the Program, i.e. the whole AST, to a string."
input Absyn.Program inProgram;
input Boolean inBoolean;
output String outString;

algorithm

...

end unparseStr;}}}

Dump.unparseStr(prog);

Gives error: Expected boolean scalar, got:TYPE[0] -> NONE

This error comes from dynamically loading the function. It should come much sooner (say, in elabCall). It is correct that it is an error though; I forgot the second argument.

Other examples that give weird output:
{{{package P
function fn

input Integer i;
output String s;

algorithm

s := String(i);

end fn;

function f0

output String s;

algorithm

s := fn();

end f0;
function f1

output String s;

algorithm

s := fn(1);

end f1;
function f2

output String s;

algorithm

s := fn(1,2);

end f2;

end P;}}}

{{{"0" It elaborates the call and tries to read input even though there is none...
""
"1"
""
instantiateDaeFunction failed for P.f2 in scope: <global scope>

"Error: No matching function found for P.f2() of type function() => String in component <NO COMPONENT>, candidates are function() => String
"}}}

Change History (0)

Note: See TracTickets for help on using tickets.