File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Rubberduck.CodeAnalysis/Inspections/Concrete
RubberduckTests/Inspections Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ public VariableTypeNotDeclaredInspection(RubberduckParserState state)
17
17
protected override IEnumerable < IInspectionResult > DoGetInspectionResults ( )
18
18
{
19
19
var issues = from item in State . DeclarationFinder . UserDeclarations ( DeclarationType . Variable )
20
- . Union ( State . DeclarationFinder . UserDeclarations ( DeclarationType . Constant ) )
21
20
. Union ( State . DeclarationFinder . UserDeclarations ( DeclarationType . Parameter ) )
22
21
where ( item . DeclarationType != DeclarationType . Parameter || ( item . DeclarationType == DeclarationType . Parameter && ! item . IsArray ) )
23
22
&& item . DeclarationType != DeclarationType . Control
Original file line number Diff line number Diff line change @@ -178,6 +178,25 @@ Sub Foo(arg1)
178
178
}
179
179
}
180
180
181
+ [ Test ]
182
+ [ Category ( "Inspections" ) ]
183
+ public void VariableTypeNotDeclared_Const_DoesNotReturnResult ( )
184
+ {
185
+ const string inputCode =
186
+ @"Sub Foo()
187
+ Const bar = 42
188
+ End Sub" ;
189
+ var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
190
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
191
+ {
192
+
193
+ var inspection = new VariableTypeNotDeclaredInspection ( state ) ;
194
+ var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
195
+
196
+ Assert . IsFalse ( inspectionResults . Any ( ) ) ;
197
+ }
198
+ }
199
+
181
200
[ Test ]
182
201
[ Category ( "Inspections" ) ]
183
202
public void InspectionName ( )
You can’t perform that action at this time.
0 commit comments