https://bugs.kde.org/show_bug.cgi?id=359912

            Bug ID: 359912
           Summary: Type not recognized in expressions with multiple
                    subscripts
           Product: kdev-python
           Version: frameworks
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Language support
          Assignee: m...@svenbrauch.de
          Reporter: nicolas.alva...@gmail.com

If I use multiple subscripts like a[0][1], the type of the expression is shown
as 'mixed', even in cases where doing the subscripts separately with a
temporary variable gives the correct type.

Example code:
class Inner:
    pass

class Middle:
    def __getitem__(self, key):
        return Inner()

class Outer:
    def __getitem__(self, key):
        return Middle()

aaa = Outer() # 'aaa' is Outer
bbb = aaa[0]  # 'bbb' is Middle
ccc = bbb[0]  # 'ccc' is Inner

ggg = aaa[0][0]   # 'ggg' is mixed, should be Inner
hhh = (aaa[0])[0] # this doesn't help, still mixed

Curiously, it does work for list (and maybe for all TypeContainers?):
mylist = [[['a']]]

x1 = mylist[0][0] # list of str
x2 = mylist[0][0][0] # str

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to