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

Refactor>Move Closer To Usage removes member calls #2774

Closed
IvenBach opened this issue Mar 2, 2017 · 5 comments
Closed

Refactor>Move Closer To Usage removes member calls #2774

IvenBach opened this issue Mar 2, 2017 · 5 comments
Labels
bug Identifies work items for known bugs feature-refactorings status-norepro The issue could not be reproduced. If there is a stable repro, please add that as a new comment.

Comments

@IvenBach
Copy link
Member

IvenBach commented Mar 2, 2017

Code before:

Sub TestRDMoveCloserToBefore()

    Dim someRange As Range
    
    Dim someOtherRange As Range
    

    Dim someRange As Range
    Set someRange = Selection
    
    Set someOtherRange = ActiveWorkbook.Sheets(2).Range("A1")
    
    Set someRange = someRange.Resize(someRange.Count)
    
End Sub

Code after: .Resize is gone as is .Count

Sub TestRDMoveCloserToAfter()

    'Moved someRange
    Dim someOtherRange As Range
    

    Dim someRange As Range

    Dim someRange As Range
    Set someRange = Selection
    
    Set someOtherRange = ActiveWorkbook.Sheets(2).Range("A1")
    
    Set someRange = someRange(someRange)
    
End Sub
@retailcoder retailcoder added bug Identifies work items for known bugs critical Marks a bug as a must-fix, showstopper issue feature-refactorings labels Mar 2, 2017
@retailcoder retailcoder added this to the Release 2.0.12 milestone Mar 2, 2017
@retailcoder
Copy link
Member

😨

@retailcoder retailcoder changed the title Refactor>Move Closer To Usage Refactor>Move Closer To Usage removes member calls Mar 2, 2017
@comintern
Copy link
Contributor

someRange is declared twice in the top example. Is it possible that the refactor is running twice without updating the selection cache? Note that even though the "Before" code doesn't compile due to "Duplicate declaration in current scope", the RD parser has absolutely no issue with it. That means that every usage of someRange has too many references pointed at it:

untitled

@retailcoder
Copy link
Member

@comintern shouldn't that throw a resolver error?

@comintern
Copy link
Contributor

I stand corrected. The top declaration has zero references:

screenshot from 2017-03-02 12 49 45

@IvenBach
Copy link
Member Author

IvenBach commented Mar 2, 2017

Looks like the extra Dim someRange as Range was from me not Undoing enough from a first move. I can't get it to reproduce the error now. When I do run it without the extra Dim it works fine.

Can't figure out how I got that to occur in the first place.

@retailcoder retailcoder added status-norepro The issue could not be reproduced. If there is a stable repro, please add that as a new comment. and removed critical Marks a bug as a must-fix, showstopper issue labels Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies work items for known bugs feature-refactorings status-norepro The issue could not be reproduced. If there is a stable repro, please add that as a new comment.
Projects
None yet
Development

No branches or pull requests

3 participants