Skip to content

Commit 73fe8f6

Browse files
committed
tweaked inspection to get test green without loading built-in declarations
1 parent 5057dec commit 73fe8f6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

RetailCoder.VBE/Inspections/ObjectVariableNotSetInspection.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
7575
(item.DeclarationType == DeclarationType.Function || item.DeclarationType == DeclarationType.PropertyGet)
7676
&& !item.IsArray
7777
&& item.IsTypeSpecified
78-
&& !ValueTypes.Contains(item.AsTypeName)
79-
&& (item.AsTypeDeclaration != null && (
80-
item.AsTypeDeclaration.DeclarationType != DeclarationType.Enumeration
81-
&& item.AsTypeDeclaration.DeclarationType != DeclarationType.UserDefinedType)));
78+
&& !ValueTypes.Contains(item.AsTypeName)
79+
&& (item.AsTypeDeclaration == null // null if unresolved (e.g. in unit tests)
80+
|| (item.AsTypeDeclaration.DeclarationType != DeclarationType.Enumeration && item.AsTypeDeclaration.DeclarationType != DeclarationType.UserDefinedType)));
8281

8382
var interestingReferences = interestingDeclarations
8483
.Union(interestingMembers.SelectMany(item =>

0 commit comments

Comments
 (0)