Skip to content

Commit e49a712

Browse files
committed
unified: Fix same-folder bug
1 parent 771130a commit e49a712

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ private module FolderHeuristic {
458458
*/
459459
private predicate hasConflictingDefs(Folder folder, string name) {
460460
containsDef(folder, name) and
461+
// Check for "two or more" using `exists(X) and not exists(unique(X))`
462+
containsDef(folder.getAFolder(), name) and
461463
not exists(unique(Folder child | child = folder.getAFolder() and containsDef(child, name)))
462464
}
463465

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
private protocol P {
2-
let x4: DeclaredTwiceInSubFolder; // $ MISSING: access=Subfolder1.DeclaredTwiceInSubFolder
2+
let x4: DeclaredTwiceInSubFolder; // $ access=Subfolder1.DeclaredTwiceInSubFolder
33
let x5: OnlyInSubFolder1; // $ access=OnlyInSubFolder1
44
let x6: OnlyInSubFolder2; // $ access=OnlyInSubFolder2
55
}

0 commit comments

Comments
 (0)