Opened 10 years ago

Closed 10 years ago

#2827 closed defect (fixed)

Function partial application doesn't work with polymorphic types

Reported by: Per Östlund Owned by: Martin Sjölund
Priority: high Milestone: 1.9.1
Component: MetaModelica Version: trunk
Keywords: Cc:

Description

Function partial application gives template error when compiling:

function foldr<T, FT>
  input list<T> inList;
  input FoldFunc inFoldFunc;
  input FT inStartValue;
  output FT outResult := inStartValue;

  partial function FoldFunc
    input FT inFoldArg;
    input T inElement;
    output FT outFoldArg;
  end FoldFunc;
algorithm
  for e in inList loop
    outResult := inFoldFunc(outResult, e);
  end for;
end foldr;

public function fold1<T, FT, ArgT1>
  input list<T> inList;
  input FoldFunc inFoldFunc;
  input ArgT1 inExtraArg;
  input FT inStartValue;
  output FT outResult;

  partial function FoldFunc
    input T inElement;
    input ArgT1 inConstantArg;
    input FT inFoldArg;
    output FT outFoldArg;
  end FoldFunc;
algorithm
  outResult := fold(inList, function inFoldFunc(inConstantArg = inExtraArg), inStartValue);
end fold1;

Change History (1)

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

Milestone: Bootstrapping1.9.1
Resolution: fixed
Status: newclosed

Fixed in r22352.

Note: See TracTickets for help on using tickets.