Opened 10 years ago

Closed 10 years ago

#2896 closed defect (fixed)

Looping over list array element doesn't work correctly

Reported by: perost Owned by: sjoelund.se
Priority: high Milestone: 1.9.1
Component: MetaModelica Version: trunk
Keywords: Cc:

Description

Calling this function:

function test
protected
  array<list<Integer>> a;
algorithm 
  a := arrayCreate(1, {1, 2, 3});
  for i in a[1] loop
    print("i = " + intString(i) + "\n");
  end for;
end test;

gives the output:

i = 1
i = 70330909930353

which is not quite the expected result.

Change History (3)

comment:1 Changed 10 years ago by perost

Aha, it thinks a[1] is an array, and generates code for that. Replacing a[1] with arrayGet(a, 1) works.

comment:2 Changed 10 years ago by sjoelund.se

Yeah, for i in /*array<list<#Integer>>*/ a[1] loop is the wrong type.

comment:3 Changed 10 years ago by sjoelund.se

  • Milestone changed from Bootstrapping to 1.9.1
  • Resolution set to fixed
  • Status changed from new to closed

Fixed simplify in r22766.

Note: See TracTickets for help on using tickets.