close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 21 years ago

Closed 21 years ago

Last modified 18 years ago

#120 closed defect (fixed)

A redifinition in an internal variable is shown as redefinition in a global variable

Reported by: request Owned by: danirus
Priority: normal Milestone:
Component: Kernel Version: head
Severity: minor Keywords:
Cc:

Description

A redifinition in an internal variable is shown as redefinition in a global variable

A function definition that could be done in very internal file
Real MyFun(Real axisX, Real axisY)
{

axisY = 8; Erroneus redefinition
axisX + axisY

};

/* a lot of code ... */

Real GlobalVariableAlfa = 1;
Real GlobalVariableBeta = 2;

Real Result = MyFun(GlobalVariableAlfa, GlobalVariableBeta);

The error is:
ERROR: Variable 'GlobalVariableBeta' is already defined in :
.../err/error200408-sinenviar1.tol
And must be:
ERROR: Variable 'axisY' is already defined in :
and the path of the file

If MyFun() is declared in other file, the error shows the main
file path where GlobalVariableBeta is declared

With this error message the programmer look for a GlobalVariableBeta
redefinition not for a problem inside a function.

Change History (3)

comment:1 Changed 21 years ago by danirus

Status: newassigned

comment:2 Changed 21 years ago by danirus

Resolution: fixed
Status: assignedclosed

This bug has been resolved.
Two new attributes has been added to BUserFunction Class to control which
functions has been called and which is the File where has been declared and
defined. This improvements are a previous release to resolve the problem
reported by Jaime López Aybar with Bug 96.

Now if you have three next files:

fileA.tol:

Real alfalfa = 1;
Real betala = 2;
Set Include("fileB.tol");
Real result = MyFunction(alfalfa, betala);


fileB.tol:

Set Include("fileC.tol");
Real MyFunction(Real axisX, Real axisY)
{

axisY = 8;
axisX + axisY

};


fileC.tol:

Real algomas = 100;

Trying to compile the first, fileA.tol, you can see a message that informs about
a conflict between two variables, also the names of these two variables, and the
place where the problem appears, exactly within Myfunction into file fileB.tol.

comment:3 Changed 18 years ago by Víctor de Buen Remiro

bug_file_loc: http://www.tol-project.org
Note: See TracTickets for help on using tickets.