yinwang0 / pysonar2

PySonar2: a semantic indexer for Python with interprocedual type inference

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

return type not specific enough for a specific case

yinwang0 opened this issue · comments

http://github.com/opdemand/deis/symbols/python/cm/chef_api/ChefAPI/request

The return type of the function (in picture) should contain str as its first tuple component, because resp.read() has type (HTTPResponse, None)->str. But this information was somehow lost.

Tried to write a small reproducer but couldn't reproduce the same problem:

class A:
    def f():
        return 1

def g():
    x = A()
    return x.f(), "hi"

screen shot 2013-11-22 at 5 53 56 pm
screen shot 2013-11-22 at 5 54 06 pm

It looks like this is already fixed by chance at some point. The types could be simpler though.

screen shot 2014-03-10 at 2 23 54 am