Opened 10 years ago

Closed 10 years ago

#2824 closed defect (fixed)

Issues with multi-iterator list comprehension

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

Description

Implementing List.productMap like this causes issues:

public function productMap<T1, T2, TO>
  "Given two lists and a function, forms the cartesian product of the lists and
   applies the function to each resulting pair.
     Example: productMap({1, 2}, {3, 4}, intMul) = {1*3, 1*4, 2*3, 2*4}"
  input list<T1> inList1;
  input list<T2> inList2;
  input MapFunc inMapFunc;
  output list<TO> outResult;

  partial function MapFunc
    input T1 inElement1;
    input T2 inElement2;
    output TO outResult;
  end MapFunc;
algorithm
  outResult := list(inMapFunc(e1, e2) for e1 in inList1, e2 in inList2);
end productMap;

The issue is that some scodeInst tests fail in BaseHashTable.addNoUpdCheck when adding connectors to the connection set. The is caused by NFConnectionSet.connectorHashFunc, where the first line is:

NFConnect2.CONNECTOR(name = cref) := inConnector;

But cref is {NIL} if output via anyString, so there must be some memory issues somewhere.

The failing testcases are conn3.mo, conn9.mo, ConstantConnector3.mo and expconn4.mo in flattening/modelica/scodeinst, although they all fail in the same way.

Change History (2)

comment:1 Changed 10 years ago by perost

I should maybe also point out that the cref in inConnector looks fine in the debugger both before and after the matching, but the cref variable becomes NIL after matching.

comment:2 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

Should be fixed in r22350.

Note: See TracTickets for help on using tickets.