mirror of
https://github.com/github/codeql.git
synced 2026-05-27 17:41:24 +02:00
Adds inline-expectation tests for the new shared CFG implementation in python/ql/lib/semmle/python/controlflow/internal/AstNodeImpl.qll, covering every Python binding construct that introduces a variable. The test files use MISSING: annotations to record bindings whose defining Name AST node is *not* currently reachable from the new CFG. These are the 'red' half of red-green commit pairs: subsequent commits will extend AstNodeImpl to cover each construct and remove the corresponding MISSING: marker. Confirmed-broken categories: - Import aliases (from x import a) - Annotated assignment (x: int = 1) - Exception handler (except E as e) - Match patterns (case x, case [a,b], case ... as v) - PEP 695 type params (def f[T], class C[T]) Confirmed-working (no MISSING:): - Compound targets, with-as, comprehensions, decorated def/class, walrus, starred. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
15 lines
437 B
Python
15 lines
437 B
Python
# Compound (tuple/list) assignment targets — actually wired in the new CFG.
|
|
|
|
a, b = (1, 2) # $ cfgdefines=a cfgdefines=b
|
|
[c, d] = [3, 4] # $ cfgdefines=c cfgdefines=d
|
|
|
|
# Nested unpacking.
|
|
(e, (f, g)) = (1, (2, 3)) # $ cfgdefines=e cfgdefines=f cfgdefines=g
|
|
|
|
# Star unpacking.
|
|
h, *i = [1, 2, 3] # $ cfgdefines=h cfgdefines=i
|
|
|
|
# Chained assignment with compound target.
|
|
j = k, l = (5, 6) # $ cfgdefines=j cfgdefines=k cfgdefines=l
|
|
|