Table of Contents

RDC00307 — Obsolete type hint

Severity: Information  ·  Family: RDC (Rubberduck Core analyzers)  ·  Raised by: ObsoleteTypeHintAnalyzer

A name is written with a type-declaration character - x%, name$, total& - where an As clause at its declaration states the type.

A character after a name says the type of what it names (MS-VBAL §3.3.5.3): % is an Integer, & a Long, $ a String. An As clause says it in a word, in the place a reader looks for it, and there is a character for only some of the types. The diagnostic is an opinion of the analyzer and not a condition of the language: both are legal.

What is reported:

  • the declaration of a variable, a constant, a parameter or a function that is written with the character, where its name is written;
  • a reference to a name that is written with it, when the host vouches that the name is bound to a declaration of the module (ExpressionFact.Binding): the declaration is what is changed to get rid of it.

A reference to a member of the standard library, such as Mid$ or Error$, has no declaration of the module's to change: it is not reported, and neither is a reference that the host did not bind. It is a suggestion because stating the type with an As clause does not change what the declaration is.

How it is raised

Situation Example Resolution
A variable, a constant, a parameter or a function is declared with the character. Dim count% Write the type: Dim count As Integer.
A name that is declared in the module is referred to with the character. count% = 1 Refer to it by its name: count = 1.

See also


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca