Skip to content

Commit db8a777

Browse files
committed
Fix isEffectively* predicates to members extracted from multiple assemblies
1 parent 77f8f3f commit db8a777

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

csharp/ql/src/semmle/code/csharp/Member.qll

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ class Modifiable extends Declaration, @modifiable {
9696
/** Holds if this declaration is `async`. */
9797
predicate isAsync() { this.hasModifier("async") }
9898

99-
private predicate isReallyPrivate() { this.isPrivate() and not this.isProtected() }
99+
private predicate isReallyPrivate() {
100+
this.isPrivate() and
101+
not this.isProtected() and
102+
// Rare case when a member is defined with the same name in multiple assemblies with different visibility
103+
not this.isPublic()
104+
}
100105

101106
/**
102107
* Holds if this declaration is effectively `private`. A declaration is considered
@@ -116,9 +121,13 @@ class Modifiable extends Declaration, @modifiable {
116121
}
117122

118123
private predicate isReallyInternal() {
119-
this.isInternal() and not this.isProtected()
120-
or
121-
this.isPrivate() and this.isProtected()
124+
(
125+
this.isInternal() and not this.isProtected()
126+
or
127+
this.isPrivate() and this.isProtected()
128+
) and
129+
// Rare case when a member is defined with the same name in multiple assemblies with different visibility
130+
not this.isPublic()
122131
}
123132

124133
/**

0 commit comments

Comments
 (0)