View Issue Details

IDProjectCategoryView StatusLast Update
0037378FPCCompilerpublic2020-07-17 10:15
ReporterGameHunter Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version3.2.0 
Summary0037378: Error at resolving conflict of names of generic types
DescriptionThere 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 <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.

Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

GameHunter

2020-07-17 04:33

reporter  

Generics.rar (3,836 bytes)

Sven Barth

2020-07-17 10:15

manager   ~0124116

Yes, selecting a generic using a unit name does not yet work correctly.

Issue History

Date Modified Username Field Change
2020-07-17 04:33 GameHunter New Issue
2020-07-17 04:33 GameHunter File Added: Generics.rar
2020-07-17 10:15 Sven Barth Tag Attached: generics
2020-07-17 10:15 Sven Barth Status new => confirmed
2020-07-17 10:15 Sven Barth FPCTarget => -
2020-07-17 10:15 Sven Barth Note Added: 0124116