AL icon indicating copy to clipboard operation
AL copied to clipboard

Dictionary of [Text, Interface "..."] triggers false-positive LC0003 and LC0005 errors: interface name mistaken for Object ID / casing violation

Open arsag opened this issue 7 months ago • 1 comments

1. Describe the bug Declaring a variable of type Dictionary of [Text, Interface "IMyInterface"] triggers two false-positive linter errors:

LC0003: "Do not use an Object ID for properties or variables declaration. Use Dictionary instead." — the interface name in the value type position is misidentified as an Object ID. LC0005: "Wrong casing detected! Use Dictionary instead." — a casing violation is reported on the same token. The code is valid AL and compiles successfully once the warnings are suppressed with #pragma warning disable LC0003, LC0005. No actual Object ID or casing issue exists.

2. To Reproduce Declare a variable using Dictionary of [Text, Interface "IMyInterface"]:

codeunit 50000 "My Codeunit"
{
    var
        MyDict: Dictionary of [Text, Interface "IMyInterface"]; // LC0003 + LC0005 reported here
}

interface "IMyInterface"
{
    procedure DoSomething();
}

3. Expected behavior No linter errors or warnings. Dictionary of [Text, Interface "..."] is valid AL syntax; the interface name in the value type position should not be parsed as an Object ID or trigger a casing check.

4. Actual behavior Two linter errors are reported on the interface name token inside the Dictionary value type:

error LC0003: Do not use an Object ID for properties or variables declaration. Use Dictionary instead. error LC0005: Wrong casing detected! Use Dictionary instead.

5. Versions:

  • AL Language: 17.0
  • Visual Studio Code: 1.117
  • Business Central: 28
  • Operating System:
    • Windows

arsag avatar Apr 29 '26 15:04 arsag

LC warnings are warnings of the LinterCop. You are addressing the wrong repository. The correct one is https://github.com/StefanMaron/BusinessCentral.LinterCop/issues

NKarolak avatar Apr 30 '26 07:04 NKarolak