Skip to content

Commit 94165df

Browse files
asgerfCopilot
andauthored
Apply batched suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent fa36a11 commit 94165df

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

unified/ql/lib/codeql/unified/internal/AnalysisQuality.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ private import codeql.unified.internal.NameBindingPlugin
77
/** Stats about identifiers that static name binding could resolve. */
88
module StaticNameResolutionStats implements EntityStatsSig {
99
/**
10-
* Holds if `name` has been positively identified as something that refer to a value, and static name binding
11-
* is thus not expected to resolve its members.
10+
* Holds if `name` has been positively identified as referring to a value, so static name binding
11+
* is not expected to resolve its members.
1212
*/
1313
private predicate resolvesToValue(Identifier name) {
1414
exists(AstNode decl |

unified/ql/lib/codeql/unified/internal/NameBindingPlugin.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class NameBindingPlugin extends Unit {
2929
/**
3030
* Holds if `member` can be inherited by subclasses of `cls`.
3131
*
32-
* The caller has already restricted `member` to be a member of `cls`, and
33-
* ensured that `member` is a `VariableDeclaration` or `FunctionDeclaration`.
32+
* The caller has already restricted `member` to be a member of `cls`.
3433
*/
3534
bindingset[cls, member]
3635
predicate isInheritableMember(ClassLikeDeclaration cls, Member member) { none() }

unified/ql/lib/codeql/unified/internal/StaticNameBinding.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class NameBindingNode extends TNameBindingNode {
6464
or
6565
this.isStaticMemberNamespace(result)
6666
or
67+
this.isInstanceMemberNamespace(result)
68+
or
6769
this.isLocalNamespace(result)
6870
or
6971
this.isModuleScopeNode(result)
@@ -314,7 +316,7 @@ private predicate derivedStoreReadStep(NameBindingNode node1, NameBindingNode no
314316
)
315317
}
316318

317-
/** Holds if the member represented by `node` cannot be inherited. */
319+
/** Holds if the member represented by `node` can be inherited. */
318320
pragma[nomagic]
319321
private predicate isInheritableMemberNode(NameBindingNode node) {
320322
exists(NameDeclaration decl |
@@ -563,7 +565,7 @@ private module FolderHeuristic {
563565
/**
564566
* Holds if `access` may resolve to `target` through the enclosing `accessingClass`.
565567
*
566-
* `instanceAccess` indicates if this this member should be accessed as an instance of `accessingClass`
568+
* `instanceAccess` indicates whether this member should be accessed as an instance of `accessingClass`
567569
* or as a static member.
568570
*/
569571
private predicate unqualifiedMemberAccessCand(

unified/ql/test/library-tests/static-name-binding/unqualified-access.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ASub : A { // $ access=A
1010

1111
class BSub : B { // $ access=A.B
1212
let x3: B = nil; // $ access=A.B
13-
let x4: C = nil; // $ access=A.B.C // spurious result from folder-based heuristic
13+
let x4: C = nil; // $ access=A.B.C
1414
}
1515

1616
class BSub2 : B { // $ access=A.B

0 commit comments

Comments
 (0)