Opened 14 years ago
Last modified 14 years ago
#1296 closed defect (fixed)
MetaModelica implementation doesn't pattern-match in statements
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Instantiation | Version: | 1.6.0 |
Keywords: | Cc: | Martin Sjölund, Martin Sjölund |
Description
Sample code below. The compiler also pattern-matches with constants and underscores, so these need to be implemented using the pattern matching. For equations, this is done at the same time as the translation from equations to algorithms; this function could be made simpler and everything working for algorithm statements instead. To implement this match expressions probably need to be DAE.MATCHEXP in one step; no VALUEBLOCK.
{{{package P
function f1
input Integer i;
output Integer o1;
output Integer o2;
algorithm
(o1,o2) := f2(i);
end f1;
function f2
input Integer i;
output tuple<Integer,Intger> o;
algorithm
o := (i,2*i);
end f2;
end P;}}}
Fixed, with testcase testcase meta/AlgPatternm.mos