Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#3006 closed enhancement (fixed)

Implement matching on enumerations

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

Description

I fixed the type system to allow enum variables inside metarecords in r23571, but there is no support for using enumerations in patterns yet. It seems only simple identifiers are allowed right now, so matching against an enumeration literal gives an invalid pattern error. Example:

type E = enumeration(one, two, three);

uniontype U
  record R
    E e;
  end R;
end U;

function test
protected
  U u = R(E.one);
algorithm
  _ := match u
    case R(E.one) then ();
    else fail();
  end match;
end test;

Change History (4)

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

A little related to #3005 since enumeration literals are constant identifiers

comment:2 by Martin Sjölund, 9 years ago

Milestone: Future1.9.4
Resolution: fixed
Status: newclosed

This is already working

comment:3 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:4 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.