In this test, two units are used:
Unit1 and Unit2.
The types in Unit1 are aliases of Unit2 like this:
unit Unit1;
interface
uses Unit2;
type
TypeEnum = Unit2.TypeEnum;
TypeRecord = Unit2.TypeRecord;
implementation
end.
In Unit2 i've:
unit Unit2;
interface
type
TypeEnum = (
ruNone,
ruPixelsPerInch,
ruPixelsPerCentimeter);
TypeRecord = record
dummyField: Integer;
end;
implementation
end.
Using Unit1 in a project like this
program Project1;
uses Unit1;
function AFunction(AParam1: Single;
AParam2: TypeRecord): Single;
begin
Result:= AParam1+AParam2.dummyField;
end;
function AFunction(AParam1: Single;
AParam2: TypeEnum=ruPixelsPerInch; //ERROR HERE
AParam3: TypeRecord): Single;
begin
Result:= AParam1+AParam3.dummyField;
end;
begin
AFunction(3.1234, ruPixelsPerCentimeter);
end.
result in a compiler Error : Project1.lpr(12,38) Error: Identifier not found "ruPixelsPerInch".
while it does not give an error when using the record field dummyField.
Can someone explain to me why? I think it is a language problem since the same Test gives the same errors on Delphi 12.