From 09dbbc6361c39f2c4e2462d8ddfe8bdc4198c80e Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 16 May 2020 15:10:47 +0200 Subject: [PATCH] lists and tuples should not be added --- jedi/inference/syntax_tree.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jedi/inference/syntax_tree.py b/jedi/inference/syntax_tree.py index a3f379af..42283093 100644 --- a/jedi/inference/syntax_tree.py +++ b/jedi/inference/syntax_tree.py @@ -557,8 +557,12 @@ def _is_annotation_name(name): return False -def _is_list_or_tuple(value): - return value.array_type in ('tuple', 'list') +def _is_list(value): + return value.array_type == 'list' + + +def _is_tuple(value): + return value.array_type == 'tuple' def _bool_to_value(inference_state, bool_): @@ -599,7 +603,7 @@ def _infer_comparison_part(inference_state, context, left, operator, right): elif str_operator == '+': if l_is_num and r_is_num or is_string(left) and is_string(right): return left.execute_operation(right, str_operator) - elif _is_list_or_tuple(left) and _is_list_or_tuple(right): + elif _is_list(left) and _is_list(right) or _is_tuple(left) and _is_tuple(right): return ValueSet([iterable.MergedArray(inference_state, (left, right))]) elif str_operator == '-': if l_is_num and r_is_num: