Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AA0205 is fired for assigned variables when combined with THIS keyword - wrong close reason #7898

Open
TKapitan opened this issue Nov 9, 2024 · 1 comment
Assignees
Labels

Comments

@TKapitan
Copy link

TKapitan commented Nov 9, 2024

Please include the following with each issue:

1. Describe the bug
AA0205 is fired for assigned variables when combined with THIS keyword

2. To Reproduce
Steps to reproduce the behavior:

codeunit 71698222 FS5A23Test
{
    var
        HeaderTableNo, LineTableNo : Integer;

    procedure Proc1(EDIMessageType: Enum FS5A23EDIMessageType)
    begin
        Populate(this.HeaderTableNo, this.LineTableNo);
    end;

    procedure Proc2()
    begin
        Message(Format(this.HeaderTableNo + this.LineTableNo));
    end;

    local procedure Populate(var Variable1: Integer; var Variable2: Integer)
    begin
        Variable1 := 1;
        Variable2 := 2;
    end;
}

3. Expected behavior
Warning should not be shown. The warning now disappear when you change Populate(this.HeaderTableNo, this.LineTableNo) to Populate(HeaderTableNo, LineTableNo) so it's probably related to THIS keyword and how the pass-by-reference is evaluated.

4. Actual behavior
AA0205 warning is shown

5. Versions:

  • AL Language: v14.1.1180850
  • Visual Studio Code: 1.94.2
  • Business Central: not related
  • List of Visual Studio Code extensions that you have installed: not related
  • Operating System: Windows

Internal work item: AB#557596

@TKapitan
Copy link
Author

TKapitan commented Nov 9, 2024

@nndobrev This was closed in #7886 as duplicate of #7877. However, this is not the same issue and has different impacts (I was discussing this issue at Directions on Thursday).

The linked issue is a problem with local/global variables. My issue is about a warning even when you have ONLY global variables. While I agree with the "by design" for #7877, my issue is not by design but an issue that will block anyone from using THIS keyword (as this warning is shown every time you pass this.VARIABLE to the setter.

@esbenk esbenk self-assigned this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants