Open zaneduffield opened 3 months ago
I should note that the 'a'
value isn't even compatible with the array of Char
overload.
It seems to be related specifically to the open array parameter; if you replace array of Char
with a type equivalent to array[0..1] of Char
then sonar-delphi doesn't warn about the ambiguity (and the 'a'
literal is compatible with both, but prefers the string
overload).
Constant values (like text literals) cannot be used as arguments to open array parameters.
The compiler error is:
E2192 Constants cannot be used as open array arguments
SonarDelphi isn't currently emulating this restriction correctly. This would be very easy to fix if it was limited to literals (and we might hack an incomplete fix targeting literals), but it applies to all constant expressions. The correct fix is blocked by #116.
Prerequisites
SonarDelphi version
1.6.0
SonarQube version
No response
Issue description
sonar-delphi fails to resolve the correct overload when a single-character string is passed to a function with overloads for both
string
andarray of Char
as the relevant parameter.I noticed this because a warning is logged when scanning JclStrings, and I reduced it to the minimal reproducible example.
Steps to reproduce
Minimal Delphi code exhibiting the issue
No response