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

Allow Implicit conversion from Integer to Decimal #876

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BusinessCentral.LinterCop.Test/Rule0075.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public async Task HasDiagnostic(string testCase)
[TestCase("ImplicitConversiontLabelToCode")]
[TestCase("RecordGetBuiltInMethodRecordId")]
[TestCase("RecordGetCode10ToCode20")]
[TestCase("RecordGetDecimalToInteger")]
[TestCase("RecordGetFieldRecordId")]
[TestCase("RecordGetGlobalVariable")]
[TestCase("RecordGetLocalVariable")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
codeunit 50100 MyCodeunit
{
procedure MyProcedure(MyInteger: Integer)
var
MyTabe: Record MyTabe;
begin
[|MyTabe.Get(MyInteger)|];
end;
}

table 50100 MyTabe
{
fields
{
field(1; MyField; Decimal) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class Rule0075RecordGetProcedureArguments : DiagnosticAnalyzer

private static readonly Dictionary<NavTypeKind, HashSet<NavTypeKind>> ImplicitConversions = new()
{
// Integer can be converted to Option and/or BigInteger
{ NavTypeKind.Integer, new HashSet<NavTypeKind> { NavTypeKind.Option, NavTypeKind.BigInteger } },
// Integer can be converted to Decimal, Option and/or BigInteger
{ NavTypeKind.Integer, new HashSet<NavTypeKind> { NavTypeKind.Decimal, NavTypeKind.Option, NavTypeKind.BigInteger } },

// BigInteger can be converted to Duration
{ NavTypeKind.BigInteger, new HashSet<NavTypeKind> { NavTypeKind.Duration } },
Expand Down
Loading