-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Python: Add overlay annotations to AST classes #20972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
... and everything else that it depends on.
6930b04 to
09e1f8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds overlay annotations to Python QL AST-related classes and modules to support the overlay system. The changes involve adding module-level overlay[local] annotations and introducing final class wrappers to enable proper class extension patterns.
Key changes:
- Added
overlay[local]andoverlay[global]annotations to approximately 25 QL library files and modules - Introduced final class type aliases (e.g.,
final class FinalAstNode = AstNode) to support the overlay pattern - Refactored class inheritance to use
instanceofsyntax where appropriate
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| python/ql/src/analysis/ImportFailure.ql | Added final class wrapper and converted VersionTest to extend it, removed override keyword from toString |
| python/ql/src/Variables/LoopVariableCapture/LoopVariableCaptureQuery.qll | Added final class wrapper and converted ForLoop to use instanceof syntax |
| python/ql/lib/semmle/python/types/ImportTime.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/types/Builtins.qll | Added overlay[local?] module annotation with question mark |
| python/ql/lib/semmle/python/internal/CachedStages.qll | Added overlay[local] to AST module |
| python/ql/lib/semmle/python/essa/SsaDefinitions.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/essa/SsaCompute.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/essa/Essa.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/essa/Definitions.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Variables.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Stmts.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Scope.qll | Added overlay[local] module annotation and overlay[global] to specific predicates |
| python/ql/lib/semmle/python/SSA.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Patterns.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Operations.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Module.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Keywords.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Import.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/GuardedControlFlow.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Function.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Flow.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Files.qll | Added overlay[local] module annotation and overlay[global] to getChildContainer method |
| python/ql/lib/semmle/python/Exprs.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Constants.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Comprehensions.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Comment.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/Class.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/AstGenerated.qll | Added overlay[local] module annotation |
| python/ql/lib/semmle/python/AstExtended.qll | Added overlay[local] module annotation |
| python/ql/lib/analysis/DefinitionTracking.qll | Added final class wrapper and refactored NiceLocationExpr, removed redundant toString override |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,3 +1,6 @@ | |||
| overlay[local?] | |||
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overlay annotation uses 'local?' with a question mark. This appears to be inconsistent with other files which use either 'local' or 'global'. If this is intentional to indicate optional behavior, it should be documented. If not, it should be corrected to match the standard 'overlay[local]' pattern used in other files.
WIP