Commit Graph

51 Commits

Author SHA1 Message Date
Daniil Kalinin
b83be81bb7 PY-61878 Resolve type parameters and type aliases on stubs
Do not resolve type parameters as class members

Tests for the changes above

Co-authored-by: Mikhail Golubev <mikhail.golubev@jetbrains.com>

GitOrigin-RevId: 96309ebedf26d04e375bfa3a5f8ae0bc9257d48f
2023-11-06 19:59:18 +00:00
Mikhail Golubev
98016a1ae6 PY-63367 PY-63366 Include instructions for annotations of new-styles generic functions in their own CFG
This way they have access to type parameters of these functions, and PyReferenceImpl.getResultsFromProcessor
can properly perform flow-sensitive resolve for them now that READ instructions for expressions
inside annotations and WRITE instructions for type parameters are in the same CFG. It allowed to
remove all the special logic for type parameters from PyReferenceImpl as well as from
PyUnboundLocalVariableInspection.

I had to special-case these annotations in PyResolveUtil.scopeCrawlUp, though, to "lift" their
original scope back from what ScopeUtil.getScopeOwner returns, making names defined in a class scope,
e.g., nested classes, visible to them.

GitOrigin-RevId: b2e78211565300dbcd7c2e2b246a7a8e14bb0e8f
2023-10-16 23:42:44 +00:00
Mikhail Golubev
8a5536359d [python] Simplify PyCommonResolveTestCase.assertNotResolved
GitOrigin-RevId: 26bd034de5e26ec2438f9e98a4ce648f96f04707
2023-10-05 22:02:21 +00:00
Daniil Kalinin
97185d17c8 PY-62608 PEP 695 Type Parameter Syntax: Resolve and scoping for type parameters in type aliases
GitOrigin-RevId: be532456e7a9c470d5d0a2770a7a2eb9b9b6e8de
2023-09-28 15:05:33 +00:00
Daniil Kalinin
3a70f1d22d PY-61854 PEP 695 Type Parameter Syntax: Formatting
GitOrigin-RevId: 272f956033d82626d7cf689aa561cdeab3f951da
2023-09-15 16:04:46 +00:00
Olga.Lavrichenko
c9b1045a46 DS-5427 DS-5549 Fixed parsing magic commands after empty cells
GitOrigin-RevId: d2359bacd7f772ebeaaabe7d1d43da060d2f7928
2023-09-12 13:48:51 +00:00
Mikhail Golubev
63d24cbb9d PY-34493 Enable back copying annotations from third-party .py files on Override/Implement
Since disabling turned out to be controversial. Even in the ticket some users were
against this decision claiming that it heavily annotated code bases it might be necessary
to retain all annotations from inherited method signatures. We need to think of a better
solution for controlling this behavior on case-to-case basis.

GitOrigin-RevId: c68763f0cad23de8975085e9bc8a6fd99013de3b
2023-08-09 20:53:35 +00:00
Mikhail Golubev
a2af264b63 PY-45588 Add necessary imports on completing methods of superclasses to override
I had to move addImports to PyClassRefactoringUtil because PySuperMethodCompletionContributor
resides in python-psi-impl and, thus, has no access to PyOverrideImplementUtil.

GitOrigin-RevId: cf2ac19da779977649144b2477bac3f8ae78bbcd
2023-08-09 20:53:35 +00:00
Mikhail Golubev
b50c617b7c PY-34493 Don't copy annotations from .pyi stubs and libraries on super method completion
GitOrigin-RevId: 65787827f5df5aa80986107dda0ba555b0942d40
2023-08-09 20:53:35 +00:00
Olga.Lavrichenko
d4df46d5f0 DS-4478 Reformat code removes spaces in shell commands
GitOrigin-RevId: b06215e01de70329f3c9dfef4ea330ea73400cd2
2023-07-24 17:24:56 +00:00
Daniil Kalinin
2983980cbd PY-17193, PY-10709 enable Use parentheses instead of backslashes for breaking lines option by default
Change tests according to the new default value

GitOrigin-RevId: 79a09911127532fadcc4a4d37a454887d46effa9
2023-07-07 13:26:55 +00:00
Olga.Lavrichenko
6df5bfd10d DS-1584 DS-2583 Reformat breaks IPython magic commands and shell commands
GitOrigin-RevId: 949528c951d6c9174b1bad21452a90fbdb07b418
2023-01-16 15:13:23 +00:00
lada.gagina
01f87f5c77 PY-42637 Fix quotes for TypedDict keys completion in subscription expressions
If there are quotes, suggest just the key names

GitOrigin-RevId: 58caea6ba1ceeeea790580c3d24d255a636764bb
2023-01-10 17:39:28 +00:00
Daniil Ovchinnikov
578eaaf60e rename library kotlin-stdlib-jdk8 -> kotlin-stdlib
GitOrigin-RevId: cddf45ccfd5563d3fe209bea62a1c37c94f44ff9
2023-01-10 12:22:34 +00:00
Petr Golubev
68f080743c move python formatter extensions to python.psi.impl module
GitOrigin-RevId: 452346cbd12e9c21c636dc8dbcab9a29813bc67b
2022-11-03 14:27:33 +00:00
Irina.Fediaeva
181edc5caa PY-50788: Correct resolve for inherited docstring attribute names
Now during resolve if there is no class/instance attribute with appropriate name explicitly in the class, we will try to find it in the parent classes and resolve there.

GitOrigin-RevId: 52ab5f0ad63cba187457ba3db6107997ede33dee
2022-10-03 13:21:34 +00:00
Tagir Valeev
adb060863f Text blocks used
GitOrigin-RevId: 7db538c0a10131a3f946436c85b42fe7d7dc5b10
2022-09-29 12:58:29 +00:00
Irina.Fediaeva
cce0ef17d5 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
2022-08-25 21:11:57 +00:00
Alexey Kudravtsev
85895e8989 add more SSR: replace stream expression with ContainerUtil call
GitOrigin-RevId: 629f61b8d4541fb374dedcbbce2964ddb70dfdf1
2022-08-24 11:15:49 +00:00
Daniil Kalinin
fb11ee327c PY-53200 do not autocomplete parameter list if method already have one
Test for PY-53200

Better tests for PY-53200

PY-53200 Removed unnecessary test.

`testMethodNamesDoNotDuplicateParameterList` renamed and moved closer to the corresponding ones
Removed test for method names in suggestions restored

GitOrigin-RevId: 51b0721190718c44810c16e198bad583c2af67d0
2022-05-05 11:18:29 +00:00
Semyon Proshev
7b8b5bb12f Make creating resolve context with explicit type eval context shorter
GitOrigin-RevId: 7dce0f1869ca114d729f8368273291940eda21ef
2021-06-13 14:50:11 +00:00
Dmitry Jemerov
749ce8a332 Cleanup: remove @author tags
GitOrigin-RevId: 9174eb8d77215b16f9f6c6074e6aced654d95ef1
2021-05-03 13:07:48 +00:00
Lada Gagina
726f21a3ae PY-44026 Add a flag to PyModuleNameCompletionContributor for some tests to pass
GitOrigin-RevId: 104959faf4784de40500b694556b552fdbb69021
2021-02-17 15:56:37 +00:00
Vladimir Krivosheev
99cc95ff68 cleanup
GitOrigin-RevId: a6e02daa32397b805eb1a1aa9c9855f092548eb6
2021-01-22 20:58:21 +00:00
Irina Fediaeva
48e8e52668 PY-36062: Add resolve attributes matching PyModuleType.MODULE_MEMBERS to types.ModuleType attributes. Add matching PyClassType: ModuleType to PyModuleType.
GitOrigin-RevId: d2988397e4a58f9170a90cd6a3251054dedf896f
2020-12-16 13:31:50 +00:00
Semyon Proshev
fbbb78bc4e Change receiver for initialization calls and don't resolve callee to constructors
Callee is now a receiver for these cases, previously it was `null`.
Callee is not replaced with constructors to have an ability to map it onto self/cls parameters and process `(cls: Type[T], ...) -> T` annotations.
Stay with the previous behaviour for navigation and looking for target element.

GitOrigin-RevId: c0f9894cf50fd5d7fd325f095976d096fb948e89
2020-11-11 19:30:34 +00:00
Mikhail Golubev
2d4cada4b3 PY-25832 Consider only class attributes for TypeVars wrapped in typing.Type
GitOrigin-RevId: 7cbdabfcbb5acad68e801c0c755a84acae7e8310
2020-09-18 11:47:26 +00:00
Mikhail Golubev
69aae259b1 PY-25832 Consider upper bound and constraints for completion and resolve on TypeVar
GitOrigin-RevId: c6b428965b0136f7f6051c992038dc15819b8f14
2020-09-18 11:47:26 +00:00
Vladimir Krivosheev
d4e9b09e26 cleanup (final)
GitOrigin-RevId: 93607e195763f2acf29ee0d7a280d7e07e8d2f14
2020-06-26 12:21:17 +03:00
andrey.matveev
edbd512159 PY-42772 Impl filtering positional only arguments
GitOrigin-RevId: 978dd1f4970d5b1aaa94e251cbf81dee51f2f36c
2020-06-08 10:11:19 +00:00
andrey.matveev
c4bf5bc2fc PY-42520 Impl filter repeated named args
GitOrigin-RevId: f68f51219b49792f109f94352e83f5671d53f3dd
2020-06-03 15:51:55 +03:00
andrey.matveev
3055c4293a PY-41676 Fix hasattr resolve issue str object is not callable
GitOrigin-RevId: aa9583ab678dd48a9264209b9bb2545b435e9d26
2020-05-22 11:46:28 +03:00
Vladimir Krivosheev
f2a72b34fa do not export trove from util module
GitOrigin-RevId: 666bf5e1fc45045bb9b1c391b7ec5a2ac4b65dde
2020-05-16 16:34:43 +00:00
Semyon Proshev
40c9d375e5 Don't consider metaclass.__call__(cls, *args, **kwargs) as a possible constructor (PY-17877, PY-41380)
GitOrigin-RevId: de83bde719d08de70dcff7f3ad7dfa722a66af72
2020-04-28 21:08:25 +00:00
Ilya.Kazakevich
18c1e98d54 Logging deprecated method usage
GitOrigin-RevId: f477b9aa83e5337399a5b798a21cd0d5c1490d7c
2020-04-26 22:37:36 +00:00
Lada Gagina
61ad4c3109 IDEA-CR-61508: PY-39703 Add TypedDict keys completion
GitOrigin-RevId: b4e71d5edff69b23e1f1eb68ffe77f994a6a0293
2020-04-16 20:10:49 +00:00
Aleksei Kniazev
c7d2f911af IDEA-CR-60308: typing-related items for stub files are not reexported for completion (PY-38172)
GitOrigin-RevId: d929f1cba63ece706ab415f7a7d2bd80accff40f
2020-03-23 14:01:42 +00:00
Mikhail Khorkov
aada2d1238 PY-37755 Add type inference for nonlocal/global variables
Now nonlocal/global target expressions gets type from its original reference.

GitOrigin-RevId: 2af93318bd0a1e978e9251e38ec2d6b218a021ed
2020-02-05 11:32:10 +00:00
Semyon Proshev
e554ef0533 Consider metaclass __call__ as one more possible constructor (PY-17877)
GitOrigin-RevId: 2b2a6e8ddf5bde58c628057dc609e63c135430c3
2020-02-04 12:04:59 +00:00
Semyon Proshev
d9756f9e05 Guard against duplicates provided in completion (PY-39956)
GitOrigin-RevId: f46c03dcf78b22d2d973a117a20a044bea394acf
2020-01-30 14:07:49 +00:00
Tagir Valeev
78a91459c4 Array annotations changed to type-use style (not compilable now)
GitOrigin-RevId: 68aa4ba200618083684599228e13dfdba35967a4
2020-01-16 08:11:51 +00:00
andrey.matveev
d66e0eec0e PY-10184 Impl hasattr support
GitOrigin-RevId: e5826372ddfe233656097da774d978c57ee54937
2019-12-23 13:08:30 +00:00
Stanislav Utikeev
d0407342dd [analysisTool] use CamelHumpMatcher in common tests and analysis tool
GitOrigin-RevId: cf10758e9862b521051c60bc331cd83cbb62b802
2019-12-06 15:10:09 +00:00
andrey.matveev
400d98b38f PY-38438 Fix keywords completion sorting
GitOrigin-RevId: 98dbc2456e72d4d333adcd9a774bee6945927d1e
2019-12-05 14:07:29 +00:00
Stanislav Utikeev
000c60ce9c Implement AsyncExecutionService for analysis tool and fix completion tests
GitOrigin-RevId: 843f486589bc495da791564966cc426f31d61b62
2019-12-03 15:11:09 +00:00
Stanislav Utikeev
a93839fed6 Add notNull assertion for testRelativeFromImportWhitespacesAfterDot
GitOrigin-RevId: 2ebd2e2d0c79b418596968195610037a4c1d8b71
2019-12-03 15:11:09 +00:00
Stanislav Utikeev
1d9a4e5d49 More thorough root system in analysis tool VFS
GitOrigin-RevId: 3f76429e69268d40d23c08dfd88dc2593a37efdf
2019-12-03 15:11:09 +00:00
Stanislav Utikeev
c2caaf5e07 Better asserts for instanceof in PyCommonResolveTest
GitOrigin-RevId: d069f37da3983476da49cc4813d8237996dabf4b
2019-12-03 15:11:09 +00:00
Stanislav Utikeev
64a66563fb Consistent naming for common Python tests and fixtures: (Python|Py)(Common|Platform?|Psi)(.+)
GitOrigin-RevId: 648dc76cfd3edc5567f46eceaeaaa9afa5433331
2019-12-03 15:11:09 +00:00
Stanislav Utikeev
593ea26bb1 Move Python completion test to common Python tests
GitOrigin-RevId: 120f8943fbd93a55d6e2e2d9d9e5e3b36c8c0a4f
2019-12-03 15:11:09 +00:00