Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable is used but not assigned inspection fires multiple times with With block #3636

Closed
ThunderFrame opened this issue Dec 22, 2017 · 1 comment

Comments

@ThunderFrame
Copy link
Member

ThunderFrame commented Dec 22, 2017

This code triggers the inspection 4 times, with all 4 inspections referring to the wb in With wb location;

Sub test()
    Dim wb As Workbook
    With wb             'Variable wb is used but not assigned
      Debug.Print .Name
      Debug.Print .Name
      Debug.Print .Name
    End With
End Sub

I'd argue that the inpsection should only fire once, for the above code block, as the member calls are actually against the temorary variable created by the With block, rather than against the wb variable.

Also, in my build, the quickfix for all occurrences in module throws an error.

@ThunderFrame ThunderFrame added bug Identifies work items for known bugs discussion feature-inspections labels Dec 22, 2017
@ThunderFrame ThunderFrame changed the title Variable is used byt not assigned inspection fires multiple times with With block Variable is used but not assigned inspection fires multiple times with With block Dec 22, 2017
@comintern
Copy link
Contributor

Duplicates are an easy fix (PR inbound). The BTW "quickfix for all occurrences in module throws an error" appears to be due to the selection logic in the GetQualifiedMemberName (here).

This asserts on the "in procedure" quick-fix also. The problem seems to simply be that there are multiple matching enclosures.

comintern added a commit to comintern/Rubberduck that referenced this issue Oct 15, 2018
@comintern comintern self-assigned this Oct 25, 2018
Semi-automatic bug tracker automation moved this from ToDo to Done Oct 29, 2018
IvenBach pushed a commit to IvenBach/Rubberduck that referenced this issue Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants