RDC00103 — Implicit type declarations enabled
Severity: Hint · Family: RDC (Rubberduck Core analyzers) ·
Raised by: TypeDefDirectiveAnalyzer
A module has a Def<Type> directive: DefInt, DefLng, DefStr, DefVar and the others.
A directive gives a type to every name it covers that is declared without one, by the first letter of the name
(MS-VBAL §5.2.2 Implicit Definition Directives). The type of a variable is then not written where it is
declared, and the variable Dim total is an Integer or a Variant depending on a line at the top of the module that the reader may not have in view. The diagnostic
is an opinion of the analyzer and not a condition of the language: both are legal VBA.
That the module has the directive is a fact of the way it is written: the analyzer reads it off the syntax tree, and reports each directive where it is written.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
The module has a Def<Type> directive. |
DefInt A-Z |
Remove the directive, and declare each variable with an As clause. |
See also
- RD-VBAL §2.6.4 Rubberduck Core Diagnostics
- RD-VBAL §5.2.2 Implicit Definition Directives
- RDC00106 — a variable declared without a type
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca