Opened 16 years ago

Last modified 14 years ago

#1039 closed defect (worksforme)

Improved name lookup (from MathCore)

Reported by: krsta Owned by: krsta
Priority: critical Milestone:
Component: Version:
Keywords: Cc: krsta,

Description

Consider the following model:

model Model4
  connector C1
    Real x;
  end C1;
  model M1
    C1 c1;
    Real y;

  equation 
    c1.x=y;
  end M1;
  model M2
    C1 c1;

  equation 
    m1.y=time;
  end M2;
  M1 m1;
  M2 m2;

equation 
  connect(m1.c1,m2.c1);
  connect(m1.c1,m2.c1);
end Model4;

This model should not work as the equation in M2 refers to the variable m1.y, which should not be accessible from m2. However it works in MathModelica, while Dymola gives the following error message:

Check of Model4:

Error: Variables found in types or in global scope must be constant, but m1.y wasn't.
In class Model4.M2.

Modelica Text: line 13

Used in component m2.

Modelica Text: line 20

Errors found in:
m1.y = time

Modelica Text: line 17

The model contained invalid expressions
Check aborted.
ERROR: 1 error was found

Change History (2)

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

Worked in trunk when I checked:
{{{Error: Variable m1 in package Model4 is not constant
[a.mo:16:5-16:14:writable] Error: Variable m1.y not found in scope Model4.M2}}}

Note: See TracTickets for help on using tickets.