Implicit Default Member Access

Identifies the use of non-indexed default member accesses.

Reasoning

Default member accesses hide away the actually called member. This is especially misleading if there is no indication in the expression that such a call is made and can cause errors in which a member was forgotten to be called to go unnoticed.

Default severity

Warning

Inspection type

CodeQualityIssues

Examples

This example should trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal arg As ADODB.Field) Dim bar As Variant bar = arg End Sub

This example should trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal arg As ADODB.Connection) Dim bar As String arg = bar End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal arg As ADODB.Field) Dim bar As Variant bar = arg.Value End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal arg As ADODB.Connection) Dim bar As String arg.ConnectionString = bar End Sub

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