Bug 288089

Summary: Type of parameters not inferred from a call via assigned method
Product: [Developer tools] kdev-python Reporter: Nicolás Alvarez <nalvarez>
Component: Language supportAssignee: Sven Brauch <mail>
Status: CONFIRMED ---    
Severity: wishlist CC: mail, simonandric5
Priority: NOR    
Version: git master   
Target Milestone: 1.4.0   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:

Description Nicolás Alvarez 2011-12-02 21:40:48 UTC
This code is handled just fine by kdev-python. The call fo func() done through func2() is enough to make the plugin know what the func() parameters types are, so "length" and "num" are correctly highlighted inside the func() body.

class String:
    def length(self): return 42

class Foo:
    def num(self): return 42

def func(s, l):
    return s.length() == l.num()

func2 = func
func2(String(), Foo())


However, this other case is *not* handled. When I add func as a method of String, the first param of func would behave as 'self'. So when I call s1.foonc, it gets passed the String object (s1) and the temporary Foo I create in the call. None of this is used to infer the parameter types of func(), and both num() and length() remain in black, not highlighted.

class String:
    def length(self): return 42

class Foo:
    def num(self): return 42

def func(s, l):
    return s.length() == l.num()

String.foonc = func
s1 = String()
s1.foonc(Foo())