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
Also fix PY-55231
Add declarationElement field to callable parameter to resolve parameters to class fields in dataclasses
GitOrigin-RevId: ae2703b958061df6f2d74b19920a6e3be2a084f6
Update all the /refactoring/move test sources according to the new rule - an empty line is always added after the move
(cherry picked from commit c00d1a499fb9849650eb102dd8bb5380165a1eee)
IJ-CR-17177
GitOrigin-RevId: d436af21c20ddd08b78886a333e6f98c71bcc19b
Both are implemented other the type of the corresponding class.
References resolve to any readable attribute of a class, however
some obviously wrong variants such as special "dunder" attributes
and methods are intentionally excluded from completion suggestions.
GitOrigin-RevId: 5edac14f47cba39840b15b0dd7f21e2e46077261
* Dependency info may be lost when new member is created, so we store it on PSI level
* Support target reference dependency
* Method can't be abstract when property depends on it
GitOrigin-RevId: 24b9b64ef4ce60dd19bc4696e1d7aabf6a260067
PSI element copies exists in special non-physical files (DummyHolders),
and usually references in them cannot be resolved. It led both to exceptions,
when the rest of the code insight didn't expect resolve to happen in files other
than PyFile (PY-46099), and situations when we failed to resolve a usage in
a copy and restore the corresponding import (PY-47633).
Switching to processing original declarations also revealed a problem with
inserting imports -- we might have tried to insert impossible imports for
non-top-level symbols, such as class attributes and methods. Now, these are
ignored.
GitOrigin-RevId: 6816078596a2c0aced7045a80828b7e83ebee8c0
If docorated function has a parameter and the decorator has
an argument with the same name as the parameter then we must not rename
the argument in case of renaming the parameter.
GitOrigin-RevId: ebc5dcf7448080e2762004a2779cd06700c042a8
Accordingly, don't ask to modify "overridden" constructor of a base class.
Unlike other methods, constructors in the hierarchy usually don't mean to
have identical signatures, thus it's not safe to blindly sync them this way.
GitOrigin-RevId: 61e300914831c726afea3928acd110fea8428df8
- codestyle improvements
- reuse TypeEvalContext and PyResolveContext
- check PyDunderAllReference specifically to avoid unwanted side effects
- skip resolving PyTargetExpression
- replace references with import alias in the refactoring, instead of the utility method
- added single reference search for PyStringLiteralExpressionImpl
- cleanup obsolete tests
GitOrigin-RevId: 3e33c880a8fe116a5b98583059c83b7dd67e34a2
- refs that resolve to locally available targets are not renamed
- fixed scope computation for generating new names
GitOrigin-RevId: c2ab0c93c9712f6be3ffcb4e73f72f4771e96997
- ability to inline single/all invocations and keep/remove the declaration
- handled name conflicts of local and imported vars/functions
- cases when this refactoring is not applicable can be found in PyInlineFunctionHandler
(cherry picked from commit 40e298ba2b833a4408ee774628b84fe422468b91)
GitOrigin-RevId: dd3fab59800163b4f300b410cd28a62c1ee1b6f3
instead of the whole STRING_LITERAL_EXPRESSION as it's expected to
return tokens instead of composite AST nodes, and, otherwise, real
expressions embedded inside f-strings get caught as string occurrences.
GitOrigin-RevId: 5625b7c3ba9aac37dc047c6d876df80de0a4ab31
instead of the whole STRING_LITERAL_EXPRESSION as it's expected to
return tokens instead of composite AST nodes, and, otherwise, real
expressions embedded inside f-strings get caught as string occurrences.
GitOrigin-RevId: 5625b7c3ba9aac37dc047c6d876df80de0a4ab31