Warnings on Name Collisions and/or Syntax Switch
Original Reporter info from Mantis: s5t1e3v4e3m11@hotmail.com
-
Reporter name: Steve Miller
Original Reporter info from Mantis: s5t1e3v4e3m11@hotmail.com
- Reporter name: Steve Miller
Description:
If the main program contains a variable or function/procedure with the same name as in the interface part of an included unit it should generate a warning (or at least a hint?).
Here an example program: (the unit is attached)
program warntest;
uses warnunit;
var v1:byte;
procedure procedureWithVeryGenericName;
begin
Writeln('BAD!');
end;
begin
Writeln(v1);
procedureWithVeryGenericName;
end.
Additional information:
I would expect the compiler to issue one warning (or hint) for the variable collision and one for the procedure.
Also if interface parts of different units have such collisions a warning should be issued.
Fully referencing such ambiguities should suppress the corresponding warnings.
I would also like an additional Syntax switch like "Strict name space" (or "Forbid name collisions"). This should cause that any name ambiguity forces specifying which unit to use. (Basically the option changes from issuing warnings to issuing errors.) Of course, by default it should be turned off.
The bigger the project, the more useful this feature(s) would be.
Mantis conversion info:
- Mantis ID: 11032
- Version: 2.2.0
- Monitored by: » rse (rse), » s5t1e3v4e3m11@hotmail.com (Steve Miller)