Compiler ignores unit qualifier
<h3><details><summary>Original Reporter info from Mantis: <small>mazolawins</small></summary><small> - **Reporter name:** Mazolla Winstrol </small></details></h3> ## Description: The compiler doesn't correctly respect the unit qualifier when trying to use two types with the same name defined in diferent units (i'm using mode delphi). Consider this unit \=== CODE === ``` pascal unit MyRecordDefinitionA; {$mode delphi} interface type TMyRecord<T> = record public FValue: T; class operator Add(A,B: TMyRecord<T>): TMyRecord<T>; end; implementation class operator TMyRecord<T>.Add(A,B: TMyRecord<T>): TMyRecord<T>; begin Result.FValue := A.FValue + B.FValue; end; end. ``` \=== END === The unit above defines a generic type named TMyRecord with the arithmetic operator overloaded Add. This type is supposed to be specialized with a type parameter that supports the add operation (e.g Integer types). \=== CODE === ``` pascal unit MyRecordDefinitionB; {$mode delphi} interface type TMyRecord<T> = record public FValue: T; class operator LogicalAnd(A: TMyRecord<T>; B: Boolean): TMyRecord<T>; end; implementation class operator TMyRecord<T>.LogicalAnd(A: TMyRecord<T>; B: Boolean): TMyRecord<T>; begin Result.FValue := A.FValue and B; end; end. ``` \=== END === The unit above defines a generic type named TMyRecord too, but with the logical operator overloading And. This type is supposed to be specialized with a type parameter that supports the logical and operation (e.g Boolean types). \=== CODE === ``` pascal unit MyRecordSpecialization; {$mode delphi} interface uses MyRecordDefinitionA, MyRecordDefinitionB; type TMyIntegerRecord = MyRecordDefinitionA.TMyRecord<Integer>; TMyBooleanRecord = MyRecordDefinitionB.TMyRecord<Boolean>; implementation end. ``` \=== END === The unit above defines two specialized types based on the generic type TMyRecord defined in the units MyRecordDefinitionA and MyRecordDefinitionB. When i try to compile MyRecordSpecialization, i get this error: "Operator is not overloaded: LongInt and Boolean". ## Mantis conversion info: - **Mantis ID:** 29859 - **Version:** 3.0.0 - **Monitored by:** » @zamtmn (Andrey Zubarev), » @OkobaPatino (OkobaPatino)
issue