Opened 9 years ago

Last modified 9 years ago

#3653 closed defect

Evaluation of lists — at Initial Version

Reported by: Henning Kiel Owned by: Lennart Ochel
Priority: critical Milestone: 1.9.4
Component: Code Generation Version:
Keywords: Cc: Martin Sjölund

Description

I have the following simple code:

package Main
public function main
  input list<String> args;
  output list<String> out;
protected
  list<Real> r_arr;
  list<String> s_arr;
algorithm
    r_arr := list(stringReal(s) for s in args);
    s_arr := list(String(r) for r in {1,2,3,4,5});
    out := listAppend(args,s_arr);
end main;

end Main;

I run it with omc +g=MetaModelica and the following script:

loadFile("Main.mo");
getErrorString();
Main.main({"2","3","4","5","6","7","8"});

and get the following error (seems to try to open a file with the name of the first argument):

true
""
File does not exist: 2
# Error encountered! Exiting...
# Please check the error message and the flags.

fail()

Another thing is that I cannot use list() in the script:

Main.main(list("1","2","3","4","5","6","7","8"));

leads to

"[Main.mos:3:1-3:49:writable] Error: Class list not found in scope <global scope> (looking for a function or record).
"

Change History (0)

Note: See TracTickets for help on using tickets.