Opened 5 years ago

Closed 5 years ago

#5712 closed defect (fixed)

The old frontend allows duplicate variables in protected sections input sections and output sections

Reported by: johti17@… Owned by: John Tinnerholm
Priority: low Milestone: Future
Component: Frontend Version: v1.16.0-dev
Keywords: Semantics, MetaModelica, Modelica Cc:

Description (last modified by Per Östlund)

function fz
  input Integer I;
  input Integer I;
end fz;

function fy
protected
  Integer I;
  Integer I;
end fy;

function fx
  input Integer I;
  input Integer I;
protected
  Integer X;
  Integer X;
end fx;

Duplicate variables in protected section compiles, they are simply replaced in the backend. However, this allows modellers to write duplicate declarations in MetaModelica, and in Modelica.

It seems we allow it since the specification says that duplication is allowed during inheritance.

Change History (8)

comment:1 by Francesco Casella, 5 years ago

Resolution: wontfix
Status: newclosed

@johti17, we no longer maintain the old frontend. In all likelyhood, the new front end will become the default with 1.16.0, or 2.0.0 if we skip 1.16.0.

comment:2 by Adrian Pop, 5 years ago

The old front-end is still used for MetaModelica, none of that was ported to the NF yet.
This fix is mostly for MM, but is good for Modelica too.

comment:3 by John Tinnerholm, 5 years ago

@casella

That is true for Modelica, sadly the old frontend is still in use for MetaModelica :(
I do some work over there for which fixing this ticket is a requirement.

I have not checked if this behaviour exists in the NF as well if it does I would be happy to patch it!

I made a fix Sunday evening, that needs to be polished, then this is pretty much done

comment:4 by John Tinnerholm, 5 years ago

Sorry I did not see that Adrian had already responded.

Ideally, I think MetaModelica's support in NF would be a good thing.

However, I think rather intermix MetaModelica specific extensions in the NFCode, a new folder for the MetaModelica frontend should be created which reuses the stuff used for NF

in reply to:  3 comment:5 by Per Östlund, 5 years ago

Replying to johti17:

I have not checked if this behaviour exists in the NF as well if it does I would be happy to patch it!

It doesn't, the NF is very strict about not allowing elements with the same name in a scope.

comment:6 by Per Östlund, 5 years ago

Description: modified (diff)

Added code tags for formatting.

comment:7 by Francesco Casella, 5 years ago

Resolution: wontfix
Status: closedreopened

Sorry, I didn't get that the subject was MetaModelica.

comment:8 by John Tinnerholm, 5 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.