multilang-depends / depends

Depends is a fast, comprehensive code dependency analysis tool
MIT License
195 stars 54 forks source link

Python deduced types confusion in test_deduce_type_of_non_param_var #32

Closed hongxuchen closed 2 years ago

hongxuchen commented 3 years ago

May I know why there are two candidate types in test_deduce_type_of_non_param_var?

https://github.com/multilang-depends/depends/blob/e5cb76afa0a102a92fa6b5b0bccd1805a556b7fb/src/test/java/depends/extractor/python/PythonParameterTypeDedudceTest.java#L99

class Type1:
  def f1_1():
    pass

def test(t1):
  t1.f1_1()
  t2 = t1

In the tested python code, I think that t1's type can be deduced as Type1 due to t1.f1_1(), and with t2 = t1, t2's type is also deduced the same as t1's. So I suppose that their deduced candidate type should both be only Type1.

gangz commented 2 years ago

Fixed. It is a design error. Thanks.