Summary: | Type not recognized in expressions with multiple subscripts | ||
---|---|---|---|
Product: | [Developer tools] kdev-python | Reporter: | Nicolás Alvarez <nalvarez> |
Component: | Language support | Assignee: | Sven Brauch <mail> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | mail, simonandric5 |
Priority: | NOR | ||
Version: | frameworks | ||
Target Milestone: | 1.7.3 | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kdev-python/3a534dbb961fa3757e7066583b5a24c16525ea5f | Version Fixed In: |
Description
Nicolás Alvarez
2016-02-29 02:51:51 UTC
This is broken when subscripting most expressions that aren't simply names, in cases where the returned type is found by looking at __getitem__(). Lists, tuples, dicts and some other builtin types are handled separately. Another example: class SomeClass: def __getitem__(self, key): return "Test" def some_func(): return SomeClass() aaa = some_func()[3] # should be str, but is mixed. I'll try to fix it, if I can find how all this Declaration stuff works. Git commit 3a534dbb961fa3757e7066583b5a24c16525ea5f by Francis Herne. Committed on 20/11/2016 at 15:48. Pushed by flherne into branch 'master'. Pass AbstractType::Ptr, not Declaration*, to accessAttribute() All but one caller had to look up the declaration only to have it converted back, so the previous version was pointless anyway. This allows subscripting of expressions (inc. other subscripts), when the subscripted type isn't a ListType/IndexedContainer. Differential Revision: https://phabricator.kde.org/D3422 M +1 -1 duchain/declarationbuilder.cpp M +3 -6 duchain/expressionvisitor.cpp M +3 -3 duchain/helpers.cpp M +1 -1 duchain/helpers.h M +9 -0 duchain/tests/pyduchaintest.cpp http://commits.kde.org/kdev-python/3a534dbb961fa3757e7066583b5a24c16525ea5f |