Commit Graph

2388 Commits

Author SHA1 Message Date
Morgan Bartholomew
723fb8c8d6 fixup! [PY-6591] use PyCodeInsightSettings.PREFER_FROM_IMPORT when moving module reference
(cherry picked from commit e194ea47c00647d67067377a63ff257609399c38)

IJ-MR-183300

GitOrigin-RevId: afc726fa9f2e556833f09d41e5d5f77469ca7fa6
2025-11-27 11:52:20 +00:00
Morgan Bartholomew
6d2db28b86 [PY-6591] use PyCodeInsightSettings.PREFER_FROM_IMPORT when moving module reference
(cherry picked from commit 2458902032ff1078689a2a641dfaa29e522148a5)

IJ-MR-183300

GitOrigin-RevId: f101d8aac2ad92af83ad6716a15865238856abb7
2025-11-27 11:52:20 +00:00
Mikhail Golubev
24990ca39b [python] PY-85031 Use PyAstNamedParameter.isSelf when reporting legacy positional-only parameters
It correctly takes into account the first argument of `__new__` that is also implicit,
and thus should be excluded when reporting positional-only parameters following
non-positional-only ones.


(cherry picked from commit abf09c6be5e49c21c12264d22bf63a51018fdcd6)

IJ-MR-180323

GitOrigin-RevId: 85fb7ea284a237252e8634344b968981eda56dc3
2025-11-26 19:08:59 +00:00
Mikhail Golubev
c298afb0e5 [python] PY-83347 Support mapping positional-only parameters to unpacked arguments
(cherry picked from commit 410737d5b913010933a0a2e0a2c350ff81925ee6)

IJ-MR-180323

GitOrigin-RevId: 1e0aa756a385dc498f04865e2ee99d7c7a0418e0
2025-11-26 19:08:59 +00:00
Petr
241ba26253 PY-25989 PY-84544 Widen types during type parameters substitution
(cherry picked from commit 627673fc7ed27621df839a5c1d4d31e677ce7f8c)

GitOrigin-RevId: 07803c6243370d55df0d870e2e32b38170c1fb49
2025-11-26 18:52:04 +00:00
Alexey Katsman
46011986a7 PY-85634: Make PyInterpreterInspection async for PyCharm
PyInterpreterInspection uses SDK configurators to find existing
environments and find the most suitable SDK. This operation takes time
(especially with conda on Windows), and on top it's performed on every
file change, making UI freeze all the time.

This change makes inspection asynchronous by caching the result and
triggerring inspection again to show changes on the UI.

Follow-up to IJ-MR-178613

GitOrigin-RevId: ed9e1aad89fb24ce70ba910ddd386a1adccd1baf
2025-11-25 18:47:50 +00:00
Morgan Bartholomew
470e4f879a [python] PY-28130 infer lambda parameter type from expected type
GitOrigin-RevId: e98338828b8fb9b2b3e33c57995345731f53dccb
2025-11-21 06:57:57 +00:00
evgeny.bovykin
0e048756e8 Fix an infinite recursion in PyNamedParameterImpl#getTypeFromUsages when the parameter is used in a binary expression
Before, `context.getType` was called for both sides of the binary expression. However, the type of the parameter itself was not needed, only the type of the other operand was used to check if it's None or not


(cherry picked from commit 3f70eb2d8e96fa27b4004e79650197173a86985e)

IJ-MR-172702

GitOrigin-RevId: 0d8c70aac62f15ae32ba077a009eaebb77c87504
2025-11-19 13:10:40 +00:00
evgeny.bovykin
1dc2650b56 Fix infinite recursion in PyReferenceImpl#changePropertyMethodToSameNameGetter
Avoid converting function to property getter when the reference we are resolving sits inside a property(...) call (e.g., property(__getX))

In such context we actually need the bare function, not the property


(cherry picked from commit a0409fde44955dd5407e3dcdb4fde339d6ba779b)

IJ-MR-172702

GitOrigin-RevId: 537436bef686f3f49c940231b815922c5a0a133a
2025-11-19 13:10:40 +00:00
evgeny.bovykin
b1005df634 PY-83287 Fix an infinite recursion during name resolution of property accessor decorators
During resolving decorators like `@x.setter`, `x` was checked for overloads.
For that, every function, including the one originally decorated by `@x.setter` was checked for having an `@overload` decorator.
For that, `@x.setter` was resolved again, leading to an infinite recursion.

To fix that, a direct check is added to return early if `setter`, `getter` or `deleter` are converted to known decorators.


(cherry picked from commit 2e9eaccd3146b17734902b6be69ebe7d9e9a8b95)

IJ-MR-172702

GitOrigin-RevId: 77d71e6a19f8b9005395e5c69480580b519fc73b
2025-11-19 13:10:40 +00:00
evgeny.bovykin
ccacedc456 Fix an infinite recursion in PyNamedParameterImpl#getTypeFromUsages
Use `context.assumeType` to avoid an infinite recursion while processing local variables and getting the type from usages

See tests `PyTypeTest#testAnyIsNone` and `PyTypeTest.testParameterFromUsages` for an example


(cherry picked from commit c68125b556e264d99a0bd5217827e11a666ca2e4)

IJ-MR-172702

GitOrigin-RevId: b0ee153f1164033aa97195f9a2f015c771ce7c44
2025-11-19 13:10:40 +00:00
evgeny.bovykin
415fc7276d Introduce python.use.better.control.flow.type.inference again
(cherry picked from commit a96eb77a54bf0df442ab9a2044f5bcc517007084)

IJ-MR-172702

GitOrigin-RevId: 11338db7ce64d58bfe87e1972c2c0f4cfec484d3
2025-11-19 13:10:39 +00:00
evgeny.bovykin
59df203089 PY-84469 Consider ClassVar when matching protocol and a concrete class
(cherry picked from commit 76af969cfe9318049f02dc7f6bdd03fe20a9504f)

IJ-MR-174248

GitOrigin-RevId: b34de32baf939e812169976761acd41eaa8aba38
2025-11-19 13:05:44 +00:00
evgeny.bovykin
1331c92868 PY-84464 Support @property decorator when matching a protocol and its implementation
(cherry picked from commit fcbeeb57323336c7d921edad373ea595ef687d6b)

IJ-MR-174248

GitOrigin-RevId: 6c44a1a7af026faaf4a5e9c1242ed29f3fb94e0e
2025-11-19 13:05:44 +00:00
evgeny.bovykin
59d7739bd6 PY-84461 Don't consider attributes assigned in protocol functions for protocol matching
(cherry picked from commit 5e540caf9f11b78036785cb94d189c91d1899c97)

IJ-MR-174248

GitOrigin-RevId: 53c1179c86cda95a72e57cbf08075c6e1b20aa2c
2025-11-19 13:05:44 +00:00
evgeny.bovykin
93b61ddfac PY-63802 Implement PyChangeLocalityDetector to fix disappearing highlighting when changing whitespace at the top level
By default, when only changing whitespace at the top level, DefaultChangeLocalityDetector would trigger and say that only the changed whitespace should be rehighlighted. However, highlighting for a whole file would still be dropped. After that, PyUnusedLocalInspection would not be triggered for any function in that file, meaning it would not re-highlight them, leading to an inspection warning disappearing.

Now, PyChangeLocalityDetector triggers when changing a whitespace on a top level and triggers re-highlighting of the whole file

Performance consideration: re-highlighting the whole file might be expensive (that's why ChangeLocalityDetector was introduced in the first place). However, no other ChangeLocalityDetector is implemented for Python, so most of the time the whole file is re-highlighted anyways. Re-highlighting the whole file in a new niche case of changing whitespace at the end of the file shouldn't lead to any significant performance impact.


(cherry picked from commit 8f26c59da8501f8eac78d1280888dd49ffef28d4)

IJ-MR-179295

GitOrigin-RevId: c7adf278a888fc0246351ea399e47784e6788de5
2025-11-19 09:13:13 +00:00
evgeny.bovykin
db8d420c98 PY-84977 Use distinctKeys instead of distinct to avoid duplicate entries for toMap in PyClassImpl
(cherry picked from commit e09de50357a09b0dc3d8440998b650042ba1982d)

IJ-MR-179388

GitOrigin-RevId: c05c7141203e8798c558a010c9bd9bcc7bf82101
2025-11-18 15:55:35 +00:00
evgeny.bovykin
121e605ea8 PY-84972 Fix NPE in PyInvalidCastInspection
Mark PyWithAncestors.getAncestorTypes return type as @Nullable


(cherry picked from commit fb7cbbebfac371b21456711087f82fbdaf21673c)

IJ-MR-179357

GitOrigin-RevId: f24cca2c4923f4bb06b4f7204f2c56b95047e4cf
2025-11-18 15:51:00 +00:00
Marcus Mews
33673afd98 PY-57566 Support PEP 660 editable installs.
GitOrigin-RevId: cca68d9504ae4f10a774cfbdd03c38f5176f88fd
2025-11-14 21:59:55 +00:00
Petr
54bd4ed705 PY-83529 Use more specific method parameter type
(cherry picked from commit 7337c92fb37d3813505a7c7e2701044c36aba8a1)

GitOrigin-RevId: db75b1344cb029f977d51f7f8751469c235c09b5
2025-11-12 17:28:36 +00:00
Petr
c1c6c8c945 PY-83529 Make type name reasonable (PyModuleType, PyImportedModuleType)
(cherry picked from commit a5f8641bcae3cd01eb7ff174e289cbf3ca5e3b2b)

GitOrigin-RevId: 41050e03a015e79c74ff54a390090e5e5f70d783
2025-11-12 17:28:36 +00:00
Petr
3a58a09cbe PY-83529 Do not resolve to empty skeleton package modules
(cherry picked from commit 699b50ea5e2be24852fc1c07acb4d372e760a251)

GitOrigin-RevId: 7270c13b1973eb00d88c4f7f6c71ac1a54291428
2025-11-12 17:28:36 +00:00
Marcus Mews
8ccd3203c2 PY-84484 Pycharm hangs when trying to call specific constructor
(cherry picked from commit b15a3bab218f72c1e9c717facfbff3e91eeea13f)

IJ-MR-180106

GitOrigin-RevId: 88614fddf666e170b71ef38fa4adffa9fa75da0a
2025-11-11 08:44:56 +00:00
Morgan Bartholomew
4a15c51165 [python] lsp: fix windows executable
GitOrigin-RevId: 3c328701a698a8486f3d6d191eb68def7e4e5891
2025-11-07 00:10:02 +00:00
Morgan Bartholomew
bd2c7616a2 [python] PY-85012 fix PyGotoDeclarationHandler for multi assigned local variables
(cherry picked from commit 27ae2bddd6c2b0b17a8bd2ace3c8da0229afc710)

IJ-MR-180935

GitOrigin-RevId: 02d9e5f80813fb326d0fa0c9aec38e0caec32bb5
2025-11-05 09:16:01 +00:00
Morgan Bartholomew
5e030fd6f4 [python] PY-83505 TyExternalTypeProvider
(cherry picked from commit dd483d65b2b00b83988d694fe69d11022d68270e)

GitOrigin-RevId: 08bf517949b1c74c9561a449457b9d217688bb1e
2025-11-05 02:02:56 +00:00
Morgan Bartholomew
2f20b95624 [python] PY-83505 ExternalTypeProvider extension point
(cherry picked from commit 4c576007a0f84542f5b91f5e502d0e280c3d5b7c)

GitOrigin-RevId: 57ce4325e4948c00c38a8d362c97b89de3f8b854
2025-11-05 02:02:56 +00:00
chbndrhnns
5579292ff3 [python] PY-59260 False positive assigining IntFlag enum value to an annotated variable
(cherry picked from commit 1b231b0917c41032255e90b3f524fc3d6201e80e)

IJ-CR-181224

GitOrigin-RevId: e2969be0fd18d29a1c2ba00a7ac3ad1a87edf79e
2025-11-03 22:58:33 +00:00
evgeny.bovykin
96a0d7da31 PY-84538 Report protocol instantiation as an error
(cherry picked from commit ad941a5d9a5fb852b0c28cbf259fdcc5ce3f3efb)

IJ-MR-173617

GitOrigin-RevId: 97c2b967b5a2c42d0f1c6c5f09a65beb64bd634c
2025-11-03 16:01:01 +00:00
Marcus Mews
c7d6637615 PY-84545 PY-84716 Fix class loader problem
- use given clazz's class loader to avoid "is not visible from class loader" check in java.lang.Proxy.ensureVisible()

(cherry picked from commit 5d275b1353383691fe907caa039a15706e9b7a18)

IJ-MR-178968

GitOrigin-RevId: 11d8ea6498393b0101a7c7086d8402b24be2ed5a
2025-11-03 12:46:22 +00:00
Daniil Kalinin
489b9b90aa [inspections] PY-85120 Do not consider expressions like a: list[int] | None = None a type alias
Target expression should have either explicit `TypeAlias` annotation or valid type expression in assignment without type annotation (to be considered implicit type alias)

(cherry picked from commit 1059a8df2d221bd068eee706139be20c256df549)

GitOrigin-RevId: 8c952138fbc4124f02f717ce8a1784c1f0dc86b2
2025-11-03 10:33:56 +00:00
Daniil Kalinin
1b197eb884 PY-85080 Add quick-fix to remove unused Type Parameters
(cherry picked from commit cbb9b8136d07350075a9af8b4bc5aaa8891edd73)

GitOrigin-RevId: 81c1ddc810da8ce9619fdb679a26938bdecdb38e
2025-11-03 10:33:56 +00:00
Daniil Kalinin
7d46075b5f PY-84107 Fix Type Parameters mistakenly reported as unused in PyUnusedLocalInspection
(cherry picked from commit 0593c2290aa1c84dde96673297374efef2b27fc3)

GitOrigin-RevId: 56de9b7a6b305eb9e88dc2bf8281c93f788eae80
2025-11-03 10:33:56 +00:00
Daniil Kalinin
fcf1abdbb7 PY-84570 Do not consider bare list literal as a valid type alias
(cherry picked from commit f0bcd2445735caa7917944351140a2877d0b4ffe)

GitOrigin-RevId: 5f0a0bff41ee01b4e8b4f7e73c1062d523854c2c
2025-11-03 10:33:56 +00:00
Aleksandr.Govenko
8c745a5c22 PY-83339 Narrow X | None type to X after assert x
(cherry picked from commit a49863065bf26f615100b21f423a650cbebbcab3)

IJ-MR-178978

GitOrigin-RevId: 4bf02cab1e94a2ab1aaa70cb0b4578688cea88b9
2025-10-31 06:18:26 +00:00
Aleksandr.Govenko
5774a281fb PY-84041 NullPointerException while opening .py with a number of case statements
(cherry picked from commit 1253ff8be848a2809634fa17acd2d0a1203849ce)

IJ-MR-178967

GitOrigin-RevId: 201674b48aa7089f04b116eaf3d4041932f9f98c
2025-10-24 17:56:36 +00:00
Morgan Bartholomew
00cdda225b [python] PY-83733 ruff support
(cherry picked from commit df443269c3a29cfe9b5f3b67663a1f998396e738)

GitOrigin-RevId: f7d5bf3905cbe4e9092ee3976509777005f3f3bb
2025-10-21 06:20:05 +00:00
Morgan Bartholomew
1514a1fc00 [python] python-lsp-core
(cherry picked from commit e07d457d959a1b589861180c1be06b995218aa2c)

GitOrigin-RevId: 032d78e90ff3263c494ceeafb2411aaceb29c643
2025-10-21 06:20:05 +00:00
Max Medvedev
6ef13aa11e [completion] IJPL-207762 nullability for LookupElement
GitOrigin-RevId: 31357e8a2d4e661cbc91a5642fe689cd3179a7e5
2025-10-12 11:39:37 +00:00
Vladimir Krivosheev
67a6dac7f8 IJPL-209476 IJ-CR-146078 kotlinx-datetime-jvm, kotlinx-document-store-mvstore, kotlinx-html-jvm, kotlinx-serialization-protobuf, kotlinx-collections-immutable
GitOrigin-RevId: 058331a1e834d7780456f98d003afe56abfc36a0
2025-10-12 11:10:47 +00:00
Vitaly Legchilkin
84934e9e9e [python] (IJPL-205889) (BAZEL-2462) don't call getOrCreateAdditionalData for non-python sdks
+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException.

also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl

[python] (IJPL-205889) (BAZEL-2462) don't call getOrCreateAdditionalData for non-python sdks

+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException

also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl

GitOrigin-RevId: 20d958c5e15cc4e05545b2e61b126b5e015696ed
2025-10-10 18:17:28 +00:00
Vladimir Krivosheev
30413b84c9 IJPL-209476 IJ-MR-175479 extract jettison, jaxen, bouncy-castle
GitOrigin-RevId: d9f6e8e745fbfb69604eb02d0f95cad976d4d7f9
2025-10-09 21:36:26 +00:00
Nikolay Chashnikov
3a8344fcad [plugin model] use 'public' visibility for content modules which classes are used from external plugins (IJPL-207059)
153 modules which contain classes used from external plugins from the Marketplace are marked as public. This is needed to ensure that it'll be possible to use that API after converting code from these external plugins to content modules.

GitOrigin-RevId: dc48e8970041fddd3bf50d280711e95ce9e9ad9b
2025-10-08 18:39:06 +00:00
Vladimir Krivosheev
4b619431c2 IJ-MR-175479 IJ-CR-146078 IJPL-209476 fast-util
GitOrigin-RevId: 87af2a3aad6e264a9b332c20ff572ec735f741f2
2025-10-06 16:34:02 +00:00
Vladimir Krivosheev
601a44264f IJ-MR-175479 IJ-CR-146078 IJPL-209476 gson as product module
GitOrigin-RevId: 4e0ec5a56b91ff85cef4343c34f36e18adec1e9e
2025-10-04 19:03:47 +00:00
Vladimir Krivosheev
351374ca85 IJ-MR-175479 IJ-CR-146078 IJPL-209476 hash4j as product module
GitOrigin-RevId: 09cdcc9248d5b0f77ad594c48b44b08e5d50cae1
2025-10-04 19:03:47 +00:00
Vladimir Krivosheev
9f425c84ea IJ-MR-175479 IJ-CR-146078 IJPL-209476 guava as product module (part 2)
GitOrigin-RevId: 22ee846c39d44cd481ad55d11889ff43ad3b389a
2025-10-04 19:03:47 +00:00
Max Medvedev
5dbaa86072 completion cleanup: use existing trimmed constants
GitOrigin-RevId: 240ae3e21585458a28038727b6b39a546ad566d8
2025-10-03 10:21:31 +00:00
Petr
3a137ebccb PY-81941 Make CallInstruction.isNoReturnCall non-recursive
GitOrigin-RevId: 4c9c1e2c6a42b6632d84667a31fb4f46936405b3
2025-09-30 21:32:41 +00:00
Petr
59740119ac PY-81941 Don't check NoReturn calls when inferring a function return type
GitOrigin-RevId: eef22498254ecee4e91c5dc3a29997a3d95e6ce1
2025-09-30 21:32:41 +00:00