Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#3006 closed enhancement (fixed)

Implement matching on enumerations

Reported by: perost Owned by: sjoelund.se
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 Changed 10 years ago by sjoelund.se

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

comment:2 Changed 9 years ago by sjoelund.se

  • Milestone changed from Future to 1.9.4
  • Resolution set to fixed
  • Status changed from new to closed

This is already working

comment:3 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.4-1.9.x

Milestone renamed

comment:4 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4-1.9.x to 1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.