pylyzer/tests/pyi.py
2024-10-06 18:46:19 +09:00

25 lines
349 B
Python

x = 1
x + "a" # OK, because x: Any
def f(x, y):
return x + y
class C:
y = 1
def __init__(self, x):
self.x = x
def f(self, x):
return self.x + x
print(f(1, 2)) # OK
print(f("a", "b")) # ERR*2
c = C(1)
print(c.f(2)) # OK
print(c.f("a")) # ERR
_ = C("a") # ERR
def g(x):
pass
print(g(c)) # OK
print(g(1)) # ERR