Error at resolving conflict of names of generic types
Original Reporter info from Mantis: GameHunter
-
Reporter name:
Original Reporter info from Mantis: GameHunter
- Reporter name:
Description:
There are 3 modules. Module A declares a generic record type Rec that contains a field x. Module B declares a generic record type Rec that contains a field y. Both the modules are used in the main program, therefore there is a conflict of name Rac exported from both A and B.
To resolve the conflict, I specify specialization of the Rec prefixed by the name of the module, for example A.specialize Rec &LtPos;integer>. However, independently on the prefix, the compiler takes Rec from the module B.
Unit A;
Interface
Type
generic Rec <AType> = record
x:AType
end;
Implementation
End.
Unit B;
Interface
Type
generic Rec <AType> = record
y:AType
end;
Implementation
End.
{$apptype console}
Program TestGenerics;
Uses
A,B;
Type
ARec = A.specialize Rec <integer>;
BRec = B.specialize Rec <integer>;
Var
aa:ARec;
bb:BRec;
Begin
bb.y:=0;
aa.y:=0; (* y is not declared in A.Rec, but there is no error in this line *)
aa.x:=0; (* Here is the error: identifier idents no member x *)
End.
Mantis conversion info:
- Mantis ID: 37378
- Version: 3.2.0