When unpacking nested tuples, kdev-python doesn't recognize the types of the unpacked variables. For example: data = (1, ('x', 3.0)) iii, ttt = data # 'iii' is int, 'ttt' is tuple sss, fff = ttt # 'sss' is str, 'fff' is float aaa, (bbb, ccc) = data # however aaa, bbb and ccc are all 'mixed' here Related: bug 314024 where this was implemented (it gave 'undefined variable' before)
Git commit 6b81441e0db9a7c34dccc627cf99c0785a00afed by Sven Brauch, on behalf of Francis Herne. Committed on 02/06/2016 at 20:41. Pushed by brauch into branch '5.0'. Adds support for PEP-3132 'Extended Iterable Unpacking' Support assignments of the form a, *b, c = 1, 2, 3, 4, 5, after which b is [2, 3, 4]. Related: bug 362521 Differential revision: https://phabricator.kde.org/D1751 Fix assignments of the form a = b = 7, a = b = 3, 4. Fix assignment from a single-element tuple: foo = (3,) makes foo a tuple, not int. Fix unpacking into a single-element tuple: foo, = [7] makes foo an int, not a list. Fix unpacking of nested tuples: foo, (bar, baz) = 2, ('a', 5.5). Declaration aliasing works for simple "a = b" assignment, e.g. def aaa(a: int): return "a" bbb = aaa It _doesn't_ work for anything more advanced, e.g. def aaa(a: int): return "a" bbb, ccc = aaa, 4 although the function type is preserved. This is a regression, aliasing works for non-nested tuple assignment without this patch. The use case is however questionable and the benefit of these changes is certainly more valuable. M +86 -104 duchain/declarationbuilder.cpp M +12 -15 duchain/declarationbuilder.h M +27 -2 duchain/tests/pyduchaintest.cpp http://commits.kde.org/kdev-python/6b81441e0db9a7c34dccc627cf99c0785a00afed