@@ -72,9 +72,9 @@ private ItemNode getAChildSuccessor(ItemNode item, string name, SuccessorKind ki
7272 if item instanceof ImplOrTraitItemNode and result instanceof AssocItem
7373 then kind .isExternal ( )
7474 else
75- if result instanceof Use
76- then kind .isInternal ( )
77- else kind .isBoth ( )
75+ if result . hasVisibility ( ) and not result instanceof Use
76+ then kind .isBoth ( )
77+ else kind .isInternal ( )
7878 )
7979}
8080
@@ -165,6 +165,8 @@ abstract class ItemNode extends Locatable {
165165 /** Gets the visibility of this item, if any. */
166166 abstract Visibility getVisibility ( ) ;
167167
168+ predicate hasVisibility ( ) { exists ( this .getVisibility ( ) ) }
169+
168170 /** Gets the `i`th type parameter of this item, if any. */
169171 abstract TypeParam getTypeParam ( int i ) ;
170172
@@ -1300,7 +1302,8 @@ private predicate useTreeDeclares(UseTree tree, string name) {
13001302 */
13011303pragma [ nomagic]
13021304private predicate declaresDirectly ( ItemNode item , Namespace ns , string name ) {
1303- exists ( ItemNode child , SuccessorKind kind | child = getAChildSuccessor ( item , name , kind ) |
1305+ exists ( ItemNode child , SuccessorKind kind |
1306+ child = getAChildSuccessor ( item , name , kind ) and
13041307 child .getNamespace ( ) = ns and
13051308 kind .isInternalOrBoth ( )
13061309 )
@@ -1501,8 +1504,13 @@ private ItemNode resolvePathCandQualified(
15011504) {
15021505 exists ( string name , SuccessorKind kind |
15031506 q = resolvePathCandQualifier ( qualifier , path , name ) and
1504- result = getASuccessor ( q , name , ns , kind ) and
1507+ result = getASuccessor ( q , name , ns , kind )
1508+ |
15051509 kind .isExternalOrBoth ( )
1510+ or
1511+ qualifier .getText ( ) = "super"
1512+ or
1513+ q instanceof Enum
15061514 )
15071515}
15081516
@@ -1657,7 +1665,7 @@ private ItemNode resolveUseTreeListItem(Use use, UseTree tree) {
16571665/** Holds if `use` imports `item` as `name`. */
16581666pragma [ nomagic]
16591667private predicate useImportEdge ( Use use , string name , ItemNode item , SuccessorKind kind ) {
1660- kind .isBoth ( ) and
1668+ ( if use . hasVisibility ( ) then kind .isBoth ( ) else kind . isInternal ( ) ) and
16611669 exists ( UseTree tree , ItemNode used |
16621670 used = resolveUseTreeListItem ( use , tree ) and
16631671 not tree .hasUseTreeList ( ) and
0 commit comments