From 62a3f99594c1d4afc029a9985d297fd1af915e38 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 1 Jun 2018 08:59:16 +0200 Subject: [PATCH] Fix a wrong branch check, fixes #1128 --- jedi/evaluate/flow_analysis.py | 3 ++- test/completion/flow_analysis.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jedi/evaluate/flow_analysis.py b/jedi/evaluate/flow_analysis.py index 946f5a2e..474071f1 100644 --- a/jedi/evaluate/flow_analysis.py +++ b/jedi/evaluate/flow_analysis.py @@ -60,7 +60,8 @@ def reachability_check(context, context_scope, node, origin_scope=None): if not branch_matches and origin_keyword == 'else' \ and node_keyword == 'except': return UNREACHABLE - break + if branch_matches: + break # Direct parents get resolved, we filter scopes that are separate # branches. This makes sense for autocompletion and static analysis. diff --git a/test/completion/flow_analysis.py b/test/completion/flow_analysis.py index af292b47..60fb94e8 100644 --- a/test/completion/flow_analysis.py +++ b/test/completion/flow_analysis.py @@ -29,6 +29,10 @@ finally: x x = tuple +if False: + with open("") as defined_in_false: + #? ['seekable'] + defined_in_false.seekab # ----------------- # Return checks