Problem (bug?) with dotted unit names and default name spaces. lazarus / 64-FPC development ---------------------------------------------------------------------- glorfin · 2020-08-21 23:56 I have two units, LMath.uPointsVec.pas in a package LMComponents, and FitLogExp in the project (ConstrFit). Both of them use the same type TRealPoint, defined in lmath.uTypes unit. In LMath.uPointsVec: uses  LMath.uTypes; // complete identifier In FitLogExp: uses uTypes; // partial identifier, but project contain -FNlmath switch. Line in FitLogExp: DataPoints.Append(Pt); //DataPoints is of type TPoints, defined in uPointsVec leads to following error message: In FitLogExp.pas(62,25) Error: Incompatible type for arg no. 1: Got "LMATH.UTYPES.TRealPoint", expected "LMATH.UTYPES.TRealPoint" If I use complete identifier in uses clause of FitLogExp, everything works fine. ---------------------------------------------------------------------- TRon · 2020-08-22 00:11 Quote from: glorfin on August 22, 2020, 01:56:09 amIn FitLogExp.pas(62,25) Error: Incompatible type for arg no. 1: Got "LMATH.UTYPES.TRealPoint", expected "LMATH.UTYPES.TRealPoint" You got to love such 'explanatory' errors  I do not know for sure if it was intended to have the distinction, but no matter what: it is a bug. Either the distinction is intended, in which case the error message is ambiguous or it is not intended to have the distinction and that fact in itself is the bug. ---------------------------------------------------------------------- glorfin · 2020-08-22 00:32 Well, if a type is incompatible with itself, it looks very much like a bug. Most probably, compiler routine which resolves unit names, first creates a list of units, found directly, afterwards it searches once more for units, combining name space provided in -FNxxxx and unit name in "uses" clause, but then forgets to test if this unit was already found, and ends up with two distinct items for the same unit. ---------------------------------------------------------------------- TRon · 2020-08-22 00:40 Your analysis reads very plausible, but fact is that it doesn't matter what caused it. It is just plain wrong (any which way you view/explain it, if even for undocumented behaviour) Nice find btw, even knowing that what you are working on made it just a matter of time. Please file a report if you are able to. ---------------------------------------------------------------------- PascalDragon · 2020-08-22 10:29 Quote from: TRon on August 22, 2020, 02:40:39 amPlease file a report if you are able to. And please provide a complete, but small and self contained example. ---------------------------------------------------------------------- glorfin · 2020-08-22 17:36 Done. Issue 0037622. ---------------------------------------------------------------------- PascalDragon · 2020-08-23 11:45 Thanks