Skip to content

AA0205 should fire when not initialized Text and Boolean variables are accessed #7447

@dannoe

Description

@dannoe

1. Describe the bug
A compare statement with Text or Boolean variables should trigger the warning AA0205

2. To Reproduce
Steps to reproduce the behavior:

var
    MyText: Text; // same for Boolean
    MyTable: Record "Sales Line";
begin
    if MyTable.FindSet() then begin
        repeat
            if MyText = '' then begin // no AA0205 warning, same for Boolean
                MyText:= 'Foo';
            end else begin
                Magic();
                MyText:= 'Bar';
            end;
        until MyTable.Next() = 0;
    end;
end;

3. Expected behavior
We should get a warning if we are comparing without initializing the variable. If the variable is of Type Code everything is working as expected an a warning is shown.

4. Actual behavior
We do not get the warning AA0205

5. Versions:

* AL Language: v11.0.810452

somewhat related: #7440

Metadata

Metadata

Assignees

No one assigned

    Labels

    CodeCopThis is a specific static-code-analysis group (AA)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions