Skip to content

Commit a788811

Browse files
committed
quickfix needs evaluator to return true when Set keyword is present
1 parent 26eb6c9 commit a788811

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Rubberduck.Inspections/VariableRequiresSetAssignmentEvaluator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static bool RequiresSetAssignment(IdentifierReference reference, Rubberdu
3232
if (setStmtContext != null)
3333
{
3434
// assignment already has a Set keyword
35+
return true;
3536
// (but is it misplaced? ...hmmm... beyond the scope of *this* inspection though)
3637
// if we're only ever assigning to 'Nothing', might as well flag it though
3738
if (reference.Declaration.References.Where(r => r.IsAssignment).All(r =>

RubberduckTests/Inspections/ObjectVariableNotSetInspectionTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ End Sub
117117
[Category("Inspections")]
118118
public void ObjectVariableNotSet_GivenIndexerObjectAccess_ReturnsResult()
119119
{
120-
var expectResultCount = 0;
120+
var expectResultCount = 1;
121121
var input =
122122
@"
123123
Private Sub DoSomething()
@@ -175,9 +175,9 @@ Private Sub TestSub(ByRef testParam As Variant)
175175

176176
[Test]
177177
[Category("Inspections")]
178-
public void ObjectVariableNotSet_GivenVariantVariableAssignedRange_ReturnsNoResult()
178+
public void ObjectVariableNotSet_GivenVariantVariableAssignedRange_ReturnsResult()
179179
{
180-
var expectResultCount = 0;
180+
var expectResultCount = 1;
181181
var input =
182182
@"
183183
Private Sub TestSub(ByRef testParam As Variant)
@@ -188,9 +188,9 @@ Private Sub TestSub(ByRef testParam As Variant)
188188

189189
[Test]
190190
[Category("Inspections")]
191-
public void ObjectVariableNotSet_GivenVariantVariableAssignedDeclaredRange_ReturnsNoResult()
191+
public void ObjectVariableNotSet_GivenVariantVariableAssignedDeclaredRange_ReturnsResult()
192192
{
193-
var expectResultCount = 0;
193+
var expectResultCount = 1;
194194
var input =
195195
@"
196196
Private Sub TestSub(ByRef testParam As Variant, target As Range)

0 commit comments

Comments
 (0)