caterinaurban / Typpete

35 stars 6 forks source link

Bug with classes #3

Closed caterinaurban closed 6 years ago

caterinaurban commented 7 years ago

From @mostafa-abdullah on July 20, 2017 12:50

The current inference allows class methods to be called as normal calls with passing the first argument as the class instance.

For example, the current is allowed (which shouldn't be)

class A:
    def f(self):
         instance = A()
         return f(instance)

And accordingly, the following is not allowed (Which should be):

def f():
     return 1

class A:
    def f(self):
         return f()

Because the inference confuses the function call f() with the method f(self)

Copied from original issue: caterinaurban/Lyra#42