File tree Expand file tree Collapse file tree
lib/codeql/unified/internal
test/library-tests/static-name-binding/package1/Sources/Target1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -280,8 +280,26 @@ private module TrackNamespaceInput implements TrackInputSig {
280280
281281private module TrackNamespace = Track< TrackNamespaceInput > ;
282282
283+ /**
284+ * Holds if `decl` is a trivial local alias for an imported name.
285+ *
286+ * Declaration-tracking usually stops at type-aliases, but trivial aliases
287+ * will be passed through.
288+ */
289+ predicate isTrivialNameAlias ( NameDeclaration decl ) {
290+ exists ( ImportDeclaration imprt |
291+ decl = getIdentifierFromRef ( imprt .getPattern ( ) ) and
292+ decl .getName ( ) = getIdentifierFromRef ( imprt .getImportedExpr ( ) ) .getValue ( )
293+ )
294+ }
295+
283296private module TrackNameDeclarationInput implements TrackInputSig {
284- predicate shouldTrack ( NameBindingNode node ) { node .isIdentifier ( any ( NameDeclaration d ) ) }
297+ predicate shouldTrack ( NameBindingNode node ) {
298+ exists ( NameDeclaration decl |
299+ node .isIdentifier ( decl ) and
300+ not isTrivialNameAlias ( decl )
301+ )
302+ }
285303}
286304
287305private module TrackNameDeclaration = Track< TrackNameDeclarationInput > ;
Original file line number Diff line number Diff line change 11class A { } // name=Target1.A
22
3- private import class Target2. B // $ access=Target2.B // name=LocalB
3+ private import class Target2. B // $ access=Target2.B
44
5- // Note: currently the local name 'B' introduced by the scoped import is also resolved as a target
6- private let x : B . C ; // $ access=Target2.B access=Target2.B.C access=LocalB
5+ private let x : B . C ; // $ access=Target2.B access=Target2.B.C
You can’t perform that action at this time.
0 commit comments