Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5712 closed defect (fixed)

The old frontend allows duplicate variables in protected sections input sections and output sections — at Version 6

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

Description (last modified by perost)

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 (6)

comment:1 Changed 5 years ago by casella

  • Resolution set to wontfix
  • Status changed from new to closed

@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 Changed 5 years ago by adrpo

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 follow-up: Changed 5 years ago by johti17

@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 Changed 5 years ago by johti17

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

comment:5 in reply to: ↑ 3 Changed 5 years ago by perost

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 Changed 5 years ago by perost

  • Description modified (diff)

Added code tags for formatting.

Note: See TracTickets for help on using tickets.