Opened 12 years ago

Last modified 12 years ago

#1770 new defect

Polymorphism breaks in RML and OMC

Reported by: Martin Sjölund Owned by: somebody
Priority: high Milestone: Future
Component: Build Environment Version: trunk
Keywords: Cc: Adrian Pop, Per Östlund

Description

The type error in the tail call is not detected (should take inExtraArg3).

public function fold3
  "Takes a list and a function operating on list elements having an extra
   argument that is 'updated', thus returned from the function, and three constant
   arguments that are not updated. fold will call the function for each element in
   a sequence, updating the start value."
  input list<ElementType> inList;
  input FoldFunc inFoldFunc;
  input ArgType1 inExtraArg1;
  input ArgType2 inExtraArg2;
  input ArgType3 inExtraArg3;
  input FoldType inStartValue;
  output FoldType outResult;

  partial function FoldFunc
    input ElementType inElement;
    input ArgType1 inConstantArg1;
    input ArgType2 inConstantArg2;
    input ArgType3 inConstantArg3;
    input FoldType inFoldArg;
    output FoldType outFoldArg;
  end FoldFunc;
algorithm
  outResult := match(inList, inFoldFunc, inExtraArg1, inExtraArg2, inExtraArg3, inStartValue)
    local
      ElementType e;
      list<ElementType> rest;
      FoldType arg;

    case ({}, _, _, _, _, _) then inStartValue;

    case (e :: rest, _, _, _, _, _)
      equation
        arg = inFoldFunc(e, inExtraArg1, inExtraArg2, inExtraArg3, inStartValue);
      then 
        fold3(rest, inFoldFunc, inExtraArg1, inExtraArg2, inExtraArg2, arg);

  end match;
end fold3;

Change History (1)

comment:1 by Martin Sjölund, 12 years ago

Milestone: Future
Note: See TracTickets for help on using tickets.