Implicitly Typed Const

Warns about constants that don't have an explicitly defined type.

Reasoning

All constants have a declared type, whether a type is specified or not. The implicit type is determined by the compiler based on the value, which is not always the expected type.

Default severity

Warning

Inspection type

CodeQualityIssues

Examples

This example should trigger a result

MyModule (StandardModule)
Const myInteger = 12345

This example should NOT trigger a result

MyModule (StandardModule)
Const myInteger As Integer = 12345

This example should NOT trigger a result

MyModule (StandardModule)
Const myInteger% = 12345

Rubberduck.CodeAnalysis.Inspections.Concrete.ImplicitlyTypedConstInspection.cs (Prerelease-v2.5.9.6289)