Closed daFreeMan closed 4 years ago
Here's another example I just ran across:
Private Sub test()
Dim foo As String
foo = "asdf"
foo = foo & "qwerty"
End Sub
The foo = "asdf"
is flagged as not used even though it's clearly used on the very next line.
In the original example, where does the result point/navigate to?
The second one is a duplicate of #4913.
Sorry, that would have been helpful...
If Not (surveys.EOF) Then
Dim ClinicID As Long
ClinicID = surveys.Fields.Item("ClinicID").Value
End If
It highlights ClinicID =
.
That case is also covered in #4913. The code path analysis part makes the wrong assumption that if blocks define a scope in VBA, which is not true.
Closing as a duplicate.
Rubberduck version information
Description I get an
Assignment is not used
inspection result when the assigned variable is used later. It seems to be code specific.To Reproduce This code produces the false positive:
This MCVE, however, does NOT produce an inspection:
Expected behavior If a variable is assigned and later used within the module, the inspection should not appear
Screenshots N/A
Logfile RubberduckLog.txt
Additional context Add any other context about the problem here.