-
Notifications
You must be signed in to change notification settings - Fork 312
Open
Labels
bugIdentifies work items for known bugsIdentifies work items for known bugscode-path-analysisInvolves simulating execution paths / interpreting the user code ..to an extent.Involves simulating execution paths / interpreting the user code ..to an extent.resolverIssue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.
Description
Rubberduck version information
Rubberduck Version 2.5.9.6316
OS: Microsoft Windows NT 10.0.19045.0, x64
Host Product: Microsoft Office x86
Host Version: 16.0.18925.20168
Host Executable: EXCEL.EXE
Description
I'm getting a "False positive" on inspection "Variable is used but not assigned."
Seemingly when the initial assignment is with ReDim.
To Reproduce
I have a number of module-level arrays that get initialized as part of an 'upload' process with the push of a button.
e.g.
' Read INVSSTFields table
rowCount = invsstTable.DataBodyRange.Rows.Count
ReDim m_INVSSTFieldInfo(0 To rowCount - 1, 0 To 4) ' FieldName, Type, Length, Required, Format
Dim invsstKeyCount As Long: invsstKeyCount = 0
For i = 1 To rowCount
m_INVSSTFieldInfo(i - 1, 0) = invsstTable.DataBodyRange.Cells(i, invsstTable.ListColumns("FieldName").Index).value
m_INVSSTFieldInfo(i - 1, 1) = invsstTable.DataBodyRange.Cells(i, invsstTable.ListColumns("Type").Index).value
m_INVSSTFieldInfo(i - 1, 2) = invsstTable.DataBodyRange.Cells(i, invsstTable.ListColumns("Length").Index).value
m_INVSSTFieldInfo(i - 1, 3) = invsstTable.DataBodyRange.Cells(i, invsstTable.ListColumns("Required").Index).value
m_INVSSTFieldInfo(i - 1, 4) = invsstTable.DataBodyRange.Cells(i, invsstTable.ListColumns("Format").Index).value
Next i
If I initialize m_INVSSTFieldInfo
with m_INVSSTFieldInfo = vbNullString
, then the inspection is happy.
Additional context
I've been using a combination of AI and RubberDuck to get some interesting work done. Thank-you!
Metadata
Metadata
Assignees
Labels
bugIdentifies work items for known bugsIdentifies work items for known bugscode-path-analysisInvolves simulating execution paths / interpreting the user code ..to an extent.Involves simulating execution paths / interpreting the user code ..to an extent.resolverIssue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.Issue is easier to resolve with knowledge of the internal resolver API and the Antlr4 parse trees.