Skip to content

New rule: Identifiers should not shadow compiler intrinsics #73

Open
@fourls

Description

@fourls

Prerequisites

  • This rule has not already been suggested.
  • This should be a new rule, not an improvement to an existing rule.
  • This rule would be generally useful, not specific to my code or setup.

Suggested rule title

Identifiers should not shadow compiler intrinsics

Rule description

This rule forbids identifiers that share a name with a compiler intrinsic.

This would include a configurable whitelist for acceptable intrinsics to shadow.

Rationale

This can be confusing for a number of reasons:

  • Compiler intrinsics have special "magic" behaviour that is not replaceable if it is shadowed (except by prefacing System.)
  • Intrinsics are almost always expected to be the intrinsic value (e.g. Break, Continue, True)
  • The Delphi IDE adds decorators for certain intrinsics, and does not differentiate between the intrinsic and a shadowing identifier of the same name

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestruleImprovements or additions to rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions