microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
718 stars 242 forks source link

AA0198 is not reported for return variables of procedures #7741

Open christianbraeunlich opened 2 months ago

christianbraeunlich commented 2 months ago

1. Describe the bug The AA0198 warning is not issued for local/internal/public return variables of procedures that have the same name as global variables.

2. To Reproduce Create a (local/internal/public) procedure with a named return variable and a global variable with the same name.

codeunit 50100 MyCodeunit
{
    var
        result: Boolean;

    procedure DoNotUseIdenticalNamesForLocalAndGlobalVariables() result: Boolean
    begin
        if result = false then
            result := true;
    end;
}

3. Expected behavior Rule AA0198 should be displayed as a warning.

codeunit 50100 MyCodeunit
{
    var
        result: Boolean;

    procedure DoNotUseIdenticalNamesForLocalAndGlobalVariables() result: Boolean // AA0198: The name of the local variable 'result' is identical to a global variable.
    begin
        if result = false then
            result := true;
    end;
}

4. Actual behavior Rule AA0198 is not displayed as a warning.

5. Versions: