RDC00107 — Implicit Variant return type
Severity: Information · Family: RDC (Rubberduck Core analyzers) ·
Raised by: ImplicitVariantReturnTypeAnalyzer
A function, a property getter or a Declare Function is declared without a return type, and returns a Variant.
A function with no As clause and no type-declaration character on its name returns the implicit type of its name, which is Variant unless a Def<Type> directive
covers the name (MS-VBAL §5.3.1.4 Function Type Declarations). A caller cannot tell what the function
returns without reading its body. The diagnostic is an opinion of the analyzer and not a condition of the language: both are legal VBA.
That a function states no return type is a fact of the way it is written: the analyzer reads it off the syntax tree, and reports the name of the function. It is a
suggestion because As Variant does not change what the function returns.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
A function, a property Get or a Declare Function has no return type. |
Function Total() |
Write the type: Function Total() As Long, or As Variant if that is intended. |
See also
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca