Skip to content

Commit 741c1d8

Browse files
Arthurvdvclaude
andauthored
docs(FC0002): describe generic type argument and object reference casing (#162)
Describe generic type argument, object reference casing and namespace-qualified object reference Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 55146ac commit 741c1d8

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

  • content/docs/analyzers/FormattingCop

content/docs/analyzers/FormattingCop/FC0002.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,65 @@ codeunit 50100 MyCodeunit
4141
}
4242
```
4343

44+
### Generic type arguments
45+
46+
FC0002 checks the casing of types used as generic type arguments inside `List of [...]`, `Dictionary of [...]`, and other generic type declarations. Both built-in type keywords and subtype keywords are checked:
47+
48+
```al
49+
codeunit 50100 MyCodeunit
50+
{
51+
var
52+
Names: List of [TEXT]; // Casing mismatch: TEXT should be Text [FC0002]
53+
Lookup: Dictionary of [INTEGER, TEXT]; // Two casing mismatches [FC0002]
54+
Nested: List of [Dictionary of [Integer, TEXT]]; // [FC0002]
55+
}
56+
```
57+
58+
### Object reference casing
59+
60+
FC0002 checks the casing of object names referenced in `Record`, `Codeunit`, `Interface`, `Page`, `XmlPort`, and other subtyped data type declarations. The object name must match the casing of the original declaration:
61+
62+
```al
63+
codeunit 50100 MyCodeunit
64+
{
65+
var
66+
Cust: Record "MY CUSTOMER"; // Casing mismatch [FC0002]
67+
Svc: Codeunit "MYHELPER"; // Casing mismatch [FC0002]
68+
}
69+
70+
table 50100 "My Customer"
71+
{
72+
fields
73+
{
74+
field(1; "Primary Key"; Integer) { }
75+
}
76+
}
77+
78+
codeunit 50101 MyHelper { }
79+
```
80+
81+
This applies to global variables, local variables, parameters, and return values. Namespace-qualified references are also checked, including the casing of each namespace part:
82+
83+
```al
84+
namespace MyPublisher.MyExtension.MyAppDomain;
85+
86+
codeunit 50100 MyCodeunit
87+
{
88+
var
89+
Cust: Record MYPUBLISHER.MYEXTENSION.MYAPPDOMAIN.MYTABLE; // Four casing mismatches [FC0002]
90+
}
91+
92+
table 50100 MyTable
93+
{
94+
fields
95+
{
96+
field(1; "Primary Key"; Integer) { }
97+
}
98+
}
99+
```
100+
101+
Object references by numeric ID (`Record 50100`) are not checked.
102+
44103
### XmlPort vs Xmlport casing
45104

46105
The AL language intentionally uses different canonical casings for xmlports depending on the context. FC0002 follows the compiler's own canonical names (the same names the AL Language extension's IntelliSense suggests) rather than enforcing a single spelling:

0 commit comments

Comments
 (0)