Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#3005 closed defect (fixed)

Constants not evaluated in match patterns

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

Description (last modified by Per Östlund)

Calling the following function from a script result in a compiler error "use of undeclared identifier '_n'. It seems we don't constant evaluate constants that are used in patterns, which we probably should.

package P
  constant Integer n = 2;

  function f
    input Integer x;
  algorithm
    _ := match x
      case n then ();
      else ();
    end match;
  end f;
end P;

function test
  input Integer x;
algorithm
  P.f(x);
end test;

Change History (4)

comment:1 by Per Östlund, 10 years ago

Description: modified (diff)

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

Milestone: Future1.9.4
Resolution: fixed
Status: newclosed

Fixed in 457cabf

We support boxed types, integers, reals, booleans, and enumerations in this way.

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.