Opened 14 years ago

Last modified 8 years ago

#1510 closed defect (fixed)

OMC allows invalid match expressions

Reported by: Per Östlund Owned by: Per Östlund
Priority: high Milestone:
Component: Frontend Version:
Keywords: Cc: Per Östlund, Martin Sjölund

Description

OMC allows the following code:

package P
  uniontype Test
    record TEST
      Real x;
      Real y;
    end TEST;
  end Test;

  public function f
    input Test t;
    output Real r;
  algorithm
    r := match(t)
      local
        Real x;

      case TEST(x) then x; 
    end match;
  end f;
end P;

Calling f like:

P.f(P.TEST(1.0, 2.0));

in OMC gives the output 1.0, while RML gives an error message for the case statement since only one field is matched against while TEST contains two fields.

Change History (3)

comment:1 by Adrian Pop, 8 years ago

Component: *unknown*

I guess is something wrong on this path: Patternm.elabPattern2 -> Patternm.elabPatternCall -> Patternm.checkMissingArgs

comment:2 by Adrian Pop, 8 years ago

Component: *unknown*Frontend

comment:3 by Adrian Pop, 8 years ago

Forget it, I was supposed to check PR: 1510 not the ticket:1510 :)

Note: See TracTickets for help on using tickets.