[Lazarus] Lazarus in trunk not working after Rev 50151 on MacOSX
Ondrej Pokorny
lazarus at kluug.net
Tue Nov 3 19:37:04 CET 2015
On 03.11.2015 17:34, Mattias Gaertner wrote:
> codetools use only a simple heuristic to calculate the type of a
> binary operator.
> The function TFindDeclarationTool.CalculateBinaryOperator needs to be
> extended for Alias types (e.g. 'integer' instead of longint) and for
> ranges (e.g. if the operands do not fit into an integer).
Maybe you are talking about the same, but just to be sure: IMO using
hard-coded alias types is not a good idea (theoretically the user can
redefine them). Instead the type evaluation should go to the end type
(e.g. from Integer to *longint*) and then the end types should be
compared. The comparison can then be done with a hard-coded table (you
need it only for the basic types, so it is OK and safe) and the type
that wins, will be used as the result type (obviously the originally
used alias).
E.g.:
procedure Test;
var
I: Integer;
S: SmallInt;
begin
Res := I + S;
end;
Something like:
1.)
I = (Integer -> longint)
S = SmallInt
2.)
ResultBasicType = Compare(longint, SmallInt) -> longint -> I
3.)
ResultType = ResultBasicType -> I -> *Integer*
Reported:
http://mantis.freepascal.org/view.php?id=28953
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151103/dd262436/attachment-0003.html>
More information about the Lazarus
mailing list