[Differential] [Request, 242 lines] D1751: Rewrite visitAssignment()
flherne (Francis Herne)
noreply at phabricator.kde.org
Thu Jun 2 19:19:10 UTC 2016
flherne created this revision.
flherne added a reviewer: brauch.
flherne set the repository for this revision to rKDEVPYTHON KDev-python.
Restricted Application added a subscriber: kdevelop-devel.
REVISION SUMMARY
Adds support for PEP-3132 'Extended Iterable Unpacking' <https://www.python.org/dev/peps/pep-3132/>, fix several other bugs, and add tests for these.
Support assignments of the form "a, *b, c = 1, 2, 3, 4, 5", after which b is [2, 3, 4].
BUG: https://bugs.kde.org/show_bug.cgi?id=362521
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)".
BUG: https://bugs.kde.org/show_bug.cgi?id=359914
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. Sven told me not to worry about that yet...
TEST PLAN
Typed stuff, compared results with python interpreter output.
Wrote and added some tests.
REPOSITORY
rKDEVPYTHON KDev-python
REVISION DETAIL
https://phabricator.kde.org/D1751
AFFECTED FILES
duchain/declarationbuilder.cpp
duchain/declarationbuilder.h
duchain/tests/pyduchaintest.cpp
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: flherne, brauch
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160602/9bd91fb0/attachment.html>
More information about the KDevelop-devel
mailing list