PY-16760, PY-28549, PY-35743, PY-55609, PY-46654: Correct resolve of class attributes in docstrings

Previously in docstrings we incorrectly recognized references in 'Attributes' section only as instance attribute references. It led to false positive 'Unresolved reference' on class attributes references in docstrings and wrong resolve when using class and instance attributes with the same names. Now we use ReferenceType.VARIABLE to identify both class and instance attribute references in 'Attributes' section and then resolve them with priority of instance attributes. Also fixed wrong resolve of attributes references to constructor parameters.

GitOrigin-RevId: ea10bfb092472c0ab14b77f06efd93093cfcd684
This commit is contained in:
Irina.Fediaeva
2022-07-27 00:12:26 +03:00
committed by intellij-monorepo-bot
parent ce84c71a5c
commit cce0ef17d5
32 changed files with 460 additions and 20 deletions

View File

@@ -0,0 +1,10 @@
class MyClass:
"""Class description
Attributes
----------
attr1:
<ref>
attr1 description
"""
attr1 = 1