StefanMaron / BusinessCentral.LinterCop

Community driven code linter for AL (MS Dynamics 365 Business Central)
https://stefanmaron.com
MIT License
72 stars 30 forks source link

LC0051 - Gives Possible Overflow but it shouldn't #549

Closed guidorobben closed 6 months ago

guidorobben commented 6 months ago

In certain cases, warning LC0051 is show when there is now problem. When setting the filter on text fields that are bigger then the field itself should not give a problem. I tested this by setting the filter with a value bigger then 100 on the field and it didn't result in an error.

ImportLine."Contact Name" is Text[100];

local procedure FindExistingContacts()
var
    Contact: Record Contact;
begin
    Contact.SetFilter(Name, '%1', '@' + ImportLine."Contact Name"); //This gives warning because this would result in length 101.
    Contact.findfirst();
end;
Arthurvdv commented 6 months ago

Duplicate of https://github.com/StefanMaron/BusinessCentral.LinterCop/issues/544

guidorobben commented 6 months ago

You are right. I did look for a open issue but the #544 started with LC0050. My bad.