-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Prerequisites
- This improvement has not already been suggested.
- This improvement would be generally useful, not specific to my code or setup.
Engine area
Delphi language support
Improvement description
In Delphi 11 and below, NativeInt is a "strong alias" that is equivalent to either Integer or Int64 (depending on the platform). In Delphi 12, the NativeInt data type is a "weak alias" that is exactly equal to Integer (on Win32) or Int64 (on Win64).
Because strong aliases have less weight when performing overload resolution, this change needs to be reflected in SonarDelphi.
This should be accompanied with retooled support for type aliases, as there is currently no way to retrieve a type alias instead of the aliased type, and without full type alias support, SonarDelphi would not be able to detect NativeInt usages at all. This would have ramifications on several rules including PlatformDependentTruncation and PlatformDependentCast.
For more details, see Marco Cantu's blog post describing the change and the RAD Studio documentation for System.NativeInt.
Rationale
This is required to have accurate overload resolution on Delphi 12 code.