Skip to content

Audit syntax-level analyzers for the four record-method receiver forms (incl. this) #348

Description

@Arthurvdv

Summary

Audit all syntax-level analyzers for correct handling of the four AL record-method receiver forms. Issue #343 showed AC0032 produced a false positive because it did not recognise the this. self-reference keyword. Other analyzers that pattern-match method receivers at the syntax level may have the same blind spot.

The four receiver forms

A record (table data) method such as Modify can reach a record through four syntactic forms:

  • MyTable.Modify() — named variable receiver
  • Rec.Modify() — implicit Rec (normal identifier)
  • Modify() — bare implicit self (no receiver)
  • this.Modify()this self-reference keyword (ThisExpressionSyntax, runtime 14.0 / BC 2024 wave 2)

Key symbol-shape gotcha: a table object's declared symbol is an ITableTypeSymbol, which is not an IRecordTypeSymbol; the record (Rec/this) is a separate IRecordTypeSymbol wrapper. ThisExpressionSyntax does not exist in the netstandard2.1 SDK and must be guarded with #if !NETSTANDARD2_1.

Scope (triage only)

For each analyzer that inspects method-call receivers at the syntax level (i.e. via IdentifierNameSyntax / MemberAccessExpressionSyntax / InvocationExpressionSyntax rather than the operation tree), determine whether all four forms are handled, and record findings. Candidate starting points (non-exhaustive, to be confirmed during the audit):

  • ALCops.FormattingCopCasingMismatchIdentifier
  • ALCops.LinterCopApiPageCanonicalFieldNameGuide
  • ALCops.PlatformCopPartialRecordOperations, UseValidateForFieldAssignment, FlowFilterFieldAssignment, IsHandledParameterAssignment, TableRelationFieldLength, TransferFieldsSchemaCompatibility

This issue is audit/triage only — do not prescribe or implement fixes here. Each confirmed gap should get its own follow-up issue.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions