Commit Graph
80 Commits
Author SHA1 Message Date
aleksei.kniazevandintellij-monorepo-bot 16786f4b89 added inspection for deleted variables with no qualifiers (PY-4537)
- treat deletion by slice and subscription expressions as read access
- delete instruction in dataflow only inserted for PyReferenceExpression

GitOrigin-RevId: 72ae5e964a1e287e007dabb8f41433b284523a02
2019-10-02 13:08:48 +00:00
Semyon Proshevandintellij-monorepo-bot a86c0b2bbe Fix building CFG for assignment expressions so target is visited after assigned value (PEP 572) (PY-33886)
GitOrigin-RevId: ac57729f8a9188a9fccf12936675c5818969435c
2019-07-02 06:52:16 +03:00
Semyon Proshev 63b4650c38 Create pending edge from continue when loop has at least one iteration (PY-29767)
There is no edge between loop statement and next after loop instruction
when loop has at least one iteration
so `continue` is marked as one more last instruction in the loop
2018-11-09 19:21:07 +03:00
Elizaveta Shashkova 1ac30ed12d Fix unbound local variable after exception inside with statement (PY-13919)
Change control flow to make it more correct for with statement. Handle special case for Unbound local variable inspection and add tests
2018-05-29 19:54:26 +03:00
Semyon Proshev 42e4964191 Visit else in while in any case even if condition is True (PY-28972)
But when condition is `True`, edge to `else` is not created.
2018-03-26 19:36:15 +03:00
Semyon Proshev 6933c9d9e0 Update CFG to honour condition values in if statements (PY-24750) 2018-03-13 16:08:46 +03:00
Semyon Proshev ddd6156be0 Consider elif inner instructions as branching points (PY-23003) 2018-03-12 17:22:16 +03:00
Semyon Proshev 222cb0d70e Don't use resolve while evaluating expressions for CFG 2018-03-07 19:21:54 +03:00
Semyon Proshev fbee38877a Fix processing normal exits from try-except when they goes out of scope (PY-22184) 2018-02-20 15:21:44 +03:00
Semyon Proshev 1b0e13c8b0 More precise CFG for for cycles by using updated evaluator (PY-19856) 2018-02-20 13:56:13 +03:00
Semyon Proshev 494a53a364 Merge PyConstantExpressionEvaluator and PyEvaluator (PY-19856) 2018-02-20 13:56:10 +03:00
Semyon Proshev 6b2814e09c Add forgotten test data (PY-25974) 2017-12-25 14:55:17 +03:00
Semyon Proshev 85bea17b09 Add pending edge from left operand in boolean expressions (PY-25974) 2017-12-25 14:24:04 +03:00
Semyon Proshev 2c1c972962 Support positive iterations in control flow (PY-14840, PY-22003) 2017-12-11 15:43:05 +03:00
Semyon Proshev 8d3d94ee88 PY-20889 Fixed: Unresolved attribute after isinstance check in boolean expression
Consider `and` and `or` expressions in PyControlFlowBuilder and use PyTypeAssertionEvaluator to make assertion for right expression.
2017-09-29 19:12:46 +03:00
Mikhail Golubev 247e0aeeb1 PY-21175 Add write instructions for assignments to attributes in CFG
to handle, in particular, lazy initialization scenarios

For instance, the statement "foo.bar = 42" should add a node
"WRITE ACCESS foo.bar" containing the corresponding target expression.

Additionally, "Unused local" inspection doesn't consider writes to
attributes, since, strictly speaking, these are not local names.
2017-07-24 14:38:41 +03:00
Mikhail Golubev bf22c95cc3 PY-21175 Add implicit negative type assertion after "if" in CFG unconditionally
The check that we should add such synthetic node only if there were no
pending edges inside the body of if statement (e.g. if it contained only
break/continue/return for the enclosing loop) seems doubtful and
doesn't cover the simplest/most common cases.
2017-07-24 14:38:41 +03:00
Mikhail Golubev 1d3eda1e2d PY-22094 Include assert statements in CFG to resolve names in f-strings inside
Otherwise it's impossible to flow-sensitively resolve names referenced
inside such f-strings since we use the containing statement as the anchor
node in the graph.
2017-03-28 16:44:21 +02:00
Semyon Proshev 05b085e461 PY-21897 Fixed: Wrong type inference with None and conditionals
Don't think that `else` after `if <reference>` means `<reference> is None`
2017-01-16 18:52:23 +03:00
Semyon Proshev a9ecefe927 PY-21474 Fixed: Type checking confused by None default argument
PyTypeAssertionEvaluator: Mark reference which is used as condition in PyConditionalExpression as non-None
2016-11-25 19:10:02 +03:00
Mikhail Golubev 8d8c3fb930 PY-20864 Python control flow builder considers variable annotations 2016-09-26 09:09:23 +03:00
Andrey Vlasovskikh 58f85ba28d Fixed 'isinstance' analysis for expressions that are resolved to tuples (PY-7573) 2013-09-18 19:53:04 +04:00
Andrey Vlasovskikh 83a912ad84 Added negative type assertions for 'else' and continue after 'if' then exit (PY-5084, PY-7694, PY-9118) 2013-04-22 17:56:52 +04:00
Andrey Vlasovskikh 451e92581d Fixed false positive in unbound vars inspection for assert False with argument (PY-7784) 2013-01-25 16:59:55 +04:00
Andrey Vlasovskikh 12d21d8ecf Fixed out-of-order for-loop body instruction in Python CFG 2012-05-17 17:57:44 +04:00
Andrey Vlasovskikh 4c1eec6846 Fixed false positive in unreachable code inspection for while-else loops (PY-6159) 2012-04-02 22:03:35 +04:00
Dmitry Jemerov 482d66ad8d visit type annotations in control flow builder 2012-01-16 18:44:54 +01:00
Dmitry Jemerov e57db64949 to make sure CFG for bad code is built correctly, visit raw targets of assignment 2012-01-16 18:39:20 +01:00
Dmitry Jemerov 85257c075a include reads of decorators in control flow graph 2012-01-16 18:21:30 +01:00
Dmitry Jemerov ef6c5862f7 include read of lambda default parameter value in control flow graph 2012-01-16 17:33:47 +01:00
Dmitry Jemerov 43b6357fa4 include read of function default parameter value in control flow graph 2012-01-16 17:23:59 +01:00
Dmitry Jemerov 60d7a4e5e9 include read of superclass expression in control flow graph 2012-01-16 17:11:01 +01:00
Andrey Vlasovskikh 783c421a55 Fixed loop-exit CFG edges in for-else loops (PY-4239) 2011-11-14 18:26:51 +04:00
Andrey Vlasovskikh 68d5c3a1f1 Don't count type assertion CFG vertices in DFA (PY-4609)
Also renamed WRITETYPE vertices to ASSERTTYPE for clarity.
2011-11-14 16:55:44 +04:00
Andrey Vlasovskikh a6b4168a55 Removed unused 'self' attributes access vertices from CFG and cleaned up unbound varirables inspection (PY-4623) 2011-11-14 16:17:12 +04:00
Andrey Vlasovskikh 2c8a328e78 Added support for not isinstance and not None type assertions (PY-2140) 2011-09-02 13:11:08 +04:00
Andrey Vlasovskikh 5c4c311642 Updated Python CFG builder tests related to try-finally statements 2011-07-18 16:29:23 +04:00
Andrey Vlasovskikh 1cf4b1d876 Separated success and failure control flow for finally clause if no except clauses found (PY-4102) 2011-07-08 22:44:50 +04:00
Andrey Vlasovskikh a5e38c84e0 Refactored Python try-except CFG builder 2011-07-08 22:44:49 +04:00
Dmitry Jemerov 4bec759ac9 let's not have Ruby code in Python control flow builder testdata 2011-07-01 16:16:53 +02:00
Andrey Vlasovskikh 5cd4809c1a Fixed bug in CFG for qualified imports (PY-3665) 2011-05-25 16:51:33 +04:00
Andrey Vlasovskikh 3a4a00b90c Special warnings for unresolved references in try-except ImportError (PY-3639) 2011-05-24 19:33:35 +04:00
Andrey Vlasovskikh d6ab1ad0b5 Lambda expressions became ScopeOwners and got their own CFG (PY-3532) 2011-05-16 18:47:24 +04:00
Andrey Vlasovskikh 24c1a13db0 Fixed bug in control flow ordering for named function arguments 2011-05-16 18:47:22 +04:00
Andrey Vlasovskikh 566d20977d Fixed control flow break edges for try-except-finally (PY-3503) 2011-05-13 20:50:25 +04:00
Andrey Vlasovskikh 99941e03ff Fixed bugs in control flow for Python list comprehensions (PY-2574) 2011-04-25 17:06:10 +04:00
Dmitry Trofimov 67bcf88cbd Revert "Revert "Merge branch 'master' of git.labs.intellij.net:idea/ultimate""
This reverts commit 3a2ad1f6c248ce02e860be14b796981de7ccfeee.
2011-02-04 17:17:18 +03:00
Dmitry Trofimov 819731653c Revert "Merge branch 'master' of git.labs.intellij.net:idea/ultimate"
This reverts commit 8c63477c4990c0667109c41ec0db1336ef689d68, reversing
changes made to 3478dde5d0c91ad1cce33478d005748849dcb85f.
2011-02-04 15:29:58 +03:00
Oleg Shpynov 915f1693f8 PY-2783 Assignment incorrectly highlighted as unused. Better fix 2011-02-02 18:35:42 +03:00
Oleg Shpynov 656e1c3085 PY-2783 Assignment incorrectly highlighted as unused 2011-02-02 18:35:39 +03:00