@@ -60,9 +60,9 @@ public override IEnumerable<IInspectionResult> GetInspectionResults()
60
60
issues . Add ( new DeclarationInspectionResult ( this ,
61
61
string . Format ( InspectionsUI . ShadowedDeclarationInspectionResultFormat ,
62
62
RubberduckUI . ResourceManager . GetString ( "DeclarationType_" + userDeclaration . DeclarationType , CultureInfo . CurrentUICulture ) ,
63
- userDeclaration . IdentifierName ,
63
+ userDeclaration . QualifiedName ,
64
64
RubberduckUI . ResourceManager . GetString ( "DeclarationType_" + shadowedDeclaration . DeclarationType , CultureInfo . CurrentUICulture ) ,
65
- shadowedDeclaration . IdentifierName ) ,
65
+ shadowedDeclaration . QualifiedName ) ,
66
66
userDeclaration ) ) ;
67
67
}
68
68
}
@@ -125,6 +125,11 @@ private static bool DeclarationInReferencedProjectCanBeShadowed(Declaration orig
125
125
return false ;
126
126
}
127
127
128
+ if ( ( originalDeclaration . ParentDeclaration as ClassModuleDeclaration ) ? . IsGlobalClassModule == false )
129
+ {
130
+ return false ;
131
+ }
132
+
128
133
var originalDeclarationComponentType = originalDeclaration . QualifiedName . QualifiedModuleName . ComponentType ;
129
134
var userDeclarationComponentType = userDeclaration . QualifiedName . QualifiedModuleName . ComponentType ;
130
135
@@ -317,8 +322,7 @@ private static bool DeclarationIsInsideOptionPrivateModule(Declaration declarati
317
322
return false ;
318
323
}
319
324
320
- var moduleDeclaration = Declaration . GetModuleParent ( declaration ) as ProceduralModuleDeclaration ;
321
- if ( moduleDeclaration != null )
325
+ if ( Declaration . GetModuleParent ( declaration ) is ProceduralModuleDeclaration moduleDeclaration )
322
326
{
323
327
return moduleDeclaration . IsPrivateModule ;
324
328
}
@@ -355,65 +359,65 @@ private static bool DeclarationIsLocal(Declaration declaration)
355
359
} . ToHashSet ( ) ,
356
360
[ DeclarationType . ProceduralModule ] = new [ ]
357
361
{
358
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
362
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
359
363
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
360
364
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
361
365
} . ToHashSet ( ) ,
362
366
[ DeclarationType . ClassModule ] = new [ ]
363
367
{
364
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . ClassModule , DeclarationType . UserForm , DeclarationType . Document ,
368
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . ClassModule , DeclarationType . UserForm
365
369
} . ToHashSet ( ) ,
366
370
[ DeclarationType . Procedure ] = new [ ]
367
371
{
368
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
372
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
369
373
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
370
374
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
371
375
} . ToHashSet ( ) ,
372
376
[ DeclarationType . Function ] = new [ ]
373
377
{
374
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
378
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
375
379
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
376
380
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
377
381
} . ToHashSet ( ) ,
378
382
[ DeclarationType . PropertyGet ] = new [ ]
379
383
{
380
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
384
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
381
385
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
382
386
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
383
387
} . ToHashSet ( ) ,
384
388
[ DeclarationType . PropertySet ] = new [ ]
385
389
{
386
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
390
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
387
391
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
388
392
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
389
393
} . ToHashSet ( ) ,
390
394
[ DeclarationType . PropertyLet ] = new [ ]
391
395
{
392
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
396
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
393
397
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
394
398
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
395
399
} . ToHashSet ( ) ,
396
400
[ DeclarationType . Variable ] = new [ ]
397
401
{
398
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
402
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
399
403
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
400
404
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
401
405
} . ToHashSet ( ) ,
402
406
[ DeclarationType . Constant ] = new [ ]
403
407
{
404
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
408
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
405
409
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
406
410
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
407
411
} . ToHashSet ( ) ,
408
412
[ DeclarationType . Enumeration ] = new [ ]
409
413
{
410
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
414
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
411
415
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
412
416
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
413
417
} . ToHashSet ( ) ,
414
418
[ DeclarationType . EnumerationMember ] = new [ ]
415
419
{
416
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
420
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
417
421
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
418
422
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
419
423
} . ToHashSet ( ) ,
@@ -423,13 +427,13 @@ private static bool DeclarationIsLocal(Declaration declaration)
423
427
} . ToHashSet ( ) ,
424
428
[ DeclarationType . LibraryProcedure ] = new [ ]
425
429
{
426
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
430
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
427
431
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
428
432
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
429
433
} . ToHashSet ( ) ,
430
434
[ DeclarationType . LibraryFunction ] = new [ ]
431
435
{
432
- DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Document , DeclarationType . Procedure , DeclarationType . Function ,
436
+ DeclarationType . Project , DeclarationType . ProceduralModule , DeclarationType . UserForm , DeclarationType . Procedure , DeclarationType . Function ,
433
437
DeclarationType . PropertyGet , DeclarationType . PropertySet , DeclarationType . PropertyLet , DeclarationType . Parameter , DeclarationType . Variable , DeclarationType . Constant ,
434
438
DeclarationType . Enumeration , DeclarationType . EnumerationMember , DeclarationType . LibraryProcedure , DeclarationType . LibraryFunction
435
439
} . ToHashSet ( )
0 commit comments