Files
Daniil Kalininandintellij-monorepo-bot eb2a834e65 PY-30190 Report unresolved class attributes in decorated classes
Previously, unresolved class attributes were not reported for the decorated classes because of potential dynamical attributes (see PY-7173). This commit enables this warning again because false-negative unresolved reference warning is much more common and distracting than the case with dynamic attributes

Merge-request: IJ-MR-105254
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: 67d1ab3fe1d5a140836d49f8ef6a65cf01873456
2023-06-20 04:39:38 +00:00

24 lines
445 B
Python

class C(object):
def foo(self):
self.bar = 1
baz = 2
@property
def quux(self):
return 3
def decorator(c):
return c
@decorator
class D(object):
foo = 1
c = C()
print(c.bar, c.baz, c.quux)
print(c.<warning descr="Unresolved attribute reference 'spam' for class 'C'">spam</warning>) #fail
d = D()
print(d.foo)
print(d.<warning descr="Unresolved attribute reference 'eggs' for class 'D'">eggs</warning>)