#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 , 10 years ago
comment:2 by , 9 years ago
Milestone: | Future → 1.9.4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
This is already working
Note:
See TracTickets
for help on using tickets.
A little related to #3005 since enumeration literals are constant identifiers