Skip to content

Ambiguous declarations erroneously found for string and array of Char parameter types #285

Open
@zaneduffield

Description

@zaneduffield

Prerequisites

  • This bug is in SonarDelphi, not SonarQube or my Delphi code.
  • This bug has not already been reported.

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 and array 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

procedure Foo(Value: array of Char); overload; begin end;
procedure Foo(Value: string); overload; begin end;

begin
  Foo('a');  // [WARN] Ambiguous declarations could not be resolved
  Foo('aa'); // no warning logged
end.

Minimal Delphi code exhibiting the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions