TFoo = type TBar
creates a new unique (non assignment compatible) type. At least for non-base types (e.g records).
In the below that works, except the new type is not entirely new. If the new type defines another type (nested), then that nested type is still compatible with the nested type of the original.
But non-commented assignments compile. (3.3.1)
Of course fields between the original and the alias are also assignment compatible.
So this may well be intended.
Just wanted to check.
program Project1;
{$Mode objfpc}
type
TRec1 = record A: integer; end;
TRec2 = type TRec1;
TFoo1 = record
a: integer;
b: record x: integer; end;
end;
TFoo2 = type TFoo1;
TBar1 = class
public type
Tbase = record A: integer; end;
TInner = type TBase;
end;
TBar2 = type TBar1;
var
r1: TRec1;
r2: TRec2;
f1: TFoo1;
f2: TFoo2;
i1: TBar1.TInner;
i2: TBar2.TInner;
begin
//r1 := r2;
//f1 := f2;
f1.b := f2.b;
i1 := i2;
end.