Bug 288089 - Type of parameters not inferred from a call via assigned method
Summary: Type of parameters not inferred from a call via assigned method
Status: CONFIRMED
Alias: None
Product: kdev-python
Classification: Developer tools
Component: Language support (show other bugs)
Version: git master
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: 1.4.0
Assignee: Sven Brauch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 21:40 UTC by Nicolás Alvarez
Modified: 2016-12-12 16:56 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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())