Commit Graph

1073 Commits

Author SHA1 Message Date
Mikhail Golubev
b5ebc17d64 PY-56541 Fix .equals for PyTypedDictType instances
Because FieldTypeAndTotality used the default Object#equals, two PyTypedDictType
instances for the same definition were not considered equivalent.

GitOrigin-RevId: a241a5199200d5c54a3ae7121e3a417aa18b4ec8
2023-03-02 18:10:00 +00:00
Mikhail Golubev
562e8b5c32 PY-56541 Shortcut matching a union with a type it already contains
GitOrigin-RevId: 050430c0fd8515a46fc4092fb679a8cacce6dc16
2023-03-02 18:09:57 +00:00
Alexandr Evstigneev
2dc83a5165 IDEA-313615 Migration to jflex 1.9.0 [regen]
The only lexer not updated is ObjectiveC, because it is using hacky manual patching, see CPP-27237

IJ-CR-103186

GitOrigin-RevId: baf62050f2c4f3f7345c5553cb6b60bca3935ab8
2023-02-24 17:20:31 +00:00
Alexandr Evstigneev
ae79cc5d2f IDEA-313615 Migration to jflex-1.9.0
IJ-CR-103186

GitOrigin-RevId: b19ccfbce13600ab9701b9424c7351cdfc38c607
2023-02-24 17:20:28 +00:00
Sergey Ignatov
32d7c37905 [fleet] fix another npe in python quick fixes, FL-18078
GitOrigin-RevId: 0193eac8dfbee98c6f370837cd996a8bb9468e69
2023-02-22 00:13:14 +00:00
Andrey Lisin
99750534ba DS-4496 Update cache only if module is not disposed
GitOrigin-RevId: 11dacd7dacdd77b44616e8fd895a2ccbe62ed42e
2023-02-21 18:24:37 +00:00
Sergey Ignatov
4002a855d8 don't create a list and peek only one element
GitOrigin-RevId: 88d8a79fb8c0444792034d6237107040b9a1b42f
2023-02-21 18:18:35 +00:00
Sergey Ignatov
a1eb77ee4f [fleet] fix FL-16875
GitOrigin-RevId: 4ddcd425abe3ac8cbbd0e21f9cfebab482e41094
2023-02-21 18:18:30 +00:00
Alexey Kudravtsev
eadeade0de mark several methods Unmodifiable to highlight more probelms
GitOrigin-RevId: 18e5e68e451ffef4333c057e33d03f865deeeb65
2023-02-21 04:13:14 +00:00
Mikhail Golubev
8077e4a522 PY-59127 Retain ParamSpec declarations in PSI stubs
GitOrigin-RevId: b497156296c6c7ce79fc22cb24c0f5b9a92bfcb9
2023-02-20 09:54:22 +00:00
Mikhail Golubev
87ad691194 Streamify PyStarImportElementImpl.iterateNames
GitOrigin-RevId: 78e027185f88403aeb24667d8827c2f622607e80
2023-02-16 21:26:36 +00:00
Mikhail Golubev
7a6c046f58 Remove remaining usages of ChainIterable
GitOrigin-RevId: 5ac71cac024c34772a88e20bbf197a16e9013749
2023-02-16 21:26:34 +00:00
Mikhail Golubev
51f356a544 Add nullability annotations for the PyTypeUtil.toUnion collector
GitOrigin-RevId: a57206edc2ef3df7eeea75a7e60d7e9024ac7524
2023-02-16 09:24:02 +00:00
Anton Bragin
cc0646e32d DS-4492 EA-648989 Check if module was disposed before Python SDK retrieval
GitOrigin-RevId: f06b2dcb2124d4231a127f4a2767a34c66f7c90a
2023-02-15 19:29:18 +00:00
Tagir Valeev
7b39079d87 [util] ReflectionUtil#proxy; used where applicable
GitOrigin-RevId: c56bf7c6d6942992b8c7d2c14b6b415e17d96ab2
2023-02-15 17:02:53 +00:00
andrey.matveev
46919b1830 PY-45143 Fix false positive redundant parentheses in yield from
GitOrigin-RevId: 0a0f2000feec265030ff16029ddda0ab72b923b9
2023-02-15 16:16:19 +00:00
Alexey Kudravtsev
91cd121707 assert no null LocalQuickFixes are passed to CommonProblemDescriptorImpl inside the "quickFixes" array (IDEA-312632), fix usages
null arrays still can be passed, but arrays with null elements are rejected because:
- consistency: it was very complicated (for both clients and implementation code) to understand if this particular fix could be null or not, and
- performance: filtering out null elements from the array and reallocating them back were noticeably expensive.
Currently, this assertion works inside tests only, to avoid irrecoverable failures in third-party plugins

GitOrigin-RevId: b71bc59eb811a807a0e6aae9609c368806f54869
2023-02-13 18:09:58 +00:00
Irina Fediaeva
da9628a3a0 PY-55118: Remove dependency to intellij.platform.lang.impl
Due to location of HtmlSyntaxInfoUtil.java we forced to create service to avoid deprecated platform dependency. This service should be removed and HtmlSyntaxInfoUtil.kt should be moved to another location.

GitOrigin-RevId: 25e7c279d69b45da927e1203d6816bd92eb4510e
2023-02-10 22:44:24 +00:00
Irina Fediaeva
bb882b63f5 PY-55118: Syntax highlighting for definition signatures in Quick Documentation
GitOrigin-RevId: b8a27a048772a0af7fcc36a9cba0d308e0ace8cc
2023-02-10 22:44:22 +00:00
Mikhail Golubev
417ae25578 PY-58658 Drop an inspection setting for metaclass "self" name, recognize more aliases
GitOrigin-RevId: 73f53f7e3318eafb87373387ea65426cc1c28662
2023-02-10 13:15:23 +00:00
Daniil Kalinin
9b471fb6f0 PY-38680 Don't treat class with method which rises NotImplementedError as abstract but keep ability to implement them
Merge-request: IJ-MR-102462
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: c94b0d90288fd9ff10ef745273110eaaf628dd2e
2023-02-09 16:52:41 +00:00
lada.gagina
89b50dedf4 PY-53612 Add support for typing.LiteralString
For now the type checker infers str for LiteralString types

GitOrigin-RevId: 26b97b18d23780f59af77fb13d0cc310375f2ff1
2023-02-07 16:57:37 +00:00
Tagir Valeev
f456ed0604 Pattern variable can be used mass cleanup
GitOrigin-RevId: 55839bf0deca5f81d0f7eb5b1c190145a5ea0037
2023-02-07 13:58:20 +00:00
Nikolay Chashnikov
c2540cd10a API: mark for removal APIs which were deprecated and have no external and internal usages (IDEA-305637)
GitOrigin-RevId: 8f4ee08f99f30456e0c0105ae4f28dc7cd8ad9b0
2023-02-06 19:59:10 +00:00
Nikolay Chashnikov
175e3373f9 [python] get rid of usage of DirectoryIndex class (IDEA-276394)
This class is going to be deprecated.

GitOrigin-RevId: 22c6e53b26ff795bf4834116afcbc7a049fb90ef
2023-02-02 23:37:21 +00:00
Tagir Valeev
17c2671635 Zero tolerance warnings fixed
GitOrigin-RevId: f6081f2ced74fd540ddef2fdcc5ef92b222a1969
2023-02-02 09:57:55 +00:00
Mikhail Golubev
566a98e5ea Make use of getGreenStub() in PyFileImpl to avoid excess PSI traversals
GitOrigin-RevId: b6271d3c3562e9b028c55900431843150dd8c68d
2023-02-01 10:41:05 +00:00
Mikhail Golubev
43c5495ef5 PY-58722 Looking for top-level imports, prune traversal on simple statements
The snapshots attached by the user indicate that we spend a ridiculous amount of
time collecting a file's import statements in PyResolveUtil.resolveImportedElementQNameLocally
during PSI stubs construction. The reason is that while we skip functions
and classes in a file, we naively scan through all expressions looking for
statements. Now, in this case, we stop the search at statements that cannot
possibly contain other statements. For that I introduced PyCompoundStatement
interface in our PSI hierarchy that also conveniently unifies "match"
statements with other "older" statements directly owning suite.

GitOrigin-RevId: 4282e5367cae4bb1b739ba51242b9719c68018a0
2023-02-01 10:41:02 +00:00
Mikhail Golubev
c750ba7884 PY-55502 Cache already read Python skeleton headers in VFS user data
I decided in favor of naive caching via getUserData/putUserData, because
to access CachedValueManager we need a project, and there are external usages
of PythonSdkUtil.isStdLib that will need to be migrated. The benefits of
CachedValueManager are not clear for this use case, however. For skeleton files,
it should be fine not to invalidate cached data because skeletons are completely
overridden by an external process on refresh, and skeletons for different SDK
are stored separately, so recorded paths should stay the same even then.
Parsing a header twice due to concurrent access is also not a problem in this
case and UserDataHolder implementation itself is thread-safe.

GitOrigin-RevId: 31f353a489861cc1cbda3a49e277f7fd6e462e13
2023-02-01 10:40:59 +00:00
Mikhail Golubev
d322a54f1a Fix a default encoding problem in PySkeletonHeader
GitOrigin-RevId: 99427b735bdcfcd4970899cb5cfc97f1a6a30bd4
2023-02-01 10:40:55 +00:00
Mikhail Golubev
ff843a1dcf PY-55502 When canonizing stdlib names, perform IO-heavy PythonSdkUtil.isStdLib last
PyStdlibCanonicalPathProvider is called as part of PyiTypeProvider.getReferenceType
during inspection passes. It reads skeleton headers under the read action
to figure out which skeletons belong to the stdlib, blocking the EDT.
However, this path provider is actually applicable only to a handful of
private modules from the standard library, and it makes no sense to perform
this costly check for all other qualified names. Reversing the order of checks
should greatly reduce the number of such IO operations until we get rid of them.

GitOrigin-RevId: d5c2529ed0c8f34384517adacdc89a43b6960114
2023-02-01 10:40:52 +00:00
Mikhail Golubev
c9557af95f PY-55502 Cleanup in PyStdlibCanonicalPathProvider
GitOrigin-RevId: 340558f26aeb9b739af0e8cb699fd64bdd2d8b61
2023-02-01 10:40:49 +00:00
Mikhail Golubev
b85c6b3ede Inline PyWhitespaceUtil into PyWhiteSpaceFormattingStrategy
GitOrigin-RevId: c6eff5b4adcf97ce8b977c811fec71c2a48e266d
2023-02-01 10:40:44 +00:00
Mikhail Golubev
387800926a Add private constructors to a couple of Python-specific utility classes
GitOrigin-RevId: 5ef383a8786912a4729bdad8268661b59d82e3de
2023-02-01 10:40:41 +00:00
Nikolay Chashnikov
327e8b38e7 [util] refactoring: extract enum describing the result of processing tree node in DFS algorithms in platform.util module
...and use it instead of ContentIteratorEx.Status. We need to use a similar one in VirtualFileUrlManager, so by extracting a common class we can reuse it and avoid conversion between different enums. Also, we have other enums which duplicate this one (com.intellij.ui.tree.TreeVisitor.Action, com.android.tools.idea.testing.DisposerExplorer.VisitResult, com.android.tools.profilers.cpu.systemtrace.SliceStream.EnumerationResult), they can be replaced by this one as well.

GitOrigin-RevId: 14faae1a96d565ab2ab506e42bfffb96eaf64ab0
2023-01-31 13:52:05 +00:00
Tagir Valeev
7a33190f27 [inspections] testOptPaneSanityChecks: more tests for labels
GitOrigin-RevId: 6420065945442503db628555d1f8ea14c6db2b42
2023-01-30 10:42:04 +00:00
Alexey Kudravtsev
32324bcb09 rename to signify it's immutable and different from other newArrayList methods
GitOrigin-RevId: 12b616da48234b3406e75f8312c6e56e70a949df
2023-01-24 18:01:07 +00:00
Alexey Kudravtsev
69278e8142 replace some newArrayList() usages with immutable List/other methods
GitOrigin-RevId: 4f4c82378a960ba5be96e31cd19893f423fb6d33
2023-01-24 17:12:20 +00:00
Mikhail Golubev
2b536b1099 PY-52656 Respect the order of type parameters in explicit Generic[...] superclass
GitOrigin-RevId: 3f75086e60103fd11ccd51230d1b90f6e8cc9709
2023-01-24 08:56:46 +00:00
Mikhail Golubev
aa9b66c647 PY-53522 Recognize generic classes parameterized with other generics
GitOrigin-RevId: edc1eb42d2dd27a12aaae955e5fad0904702f53f
2023-01-24 08:56:44 +00:00
Mikhail Golubev
d24050a2bb PY-53896 Add scoping for type vars, correct matching for generics hierarchies
This changeset introduces a few important changes to out type inference.

First of all, TypeVar instances, represented as PyGenericType objects
in our type system, finally have associated scope owners
(see https://peps.python.org/pep-0484/#scoping-rules-for-type-variables),
which allows to safely use type parameters with the same name in different
declarations. Absence of this feature, not only caused various subtle bugs
in type checking, but also led to occasional SOEs on type substitution
(e.g. PY-54336).

To make it work consistently across the board, I also added scope owners
to type parameters extracted from docstrings in our legacy python-skeletons
format.

Secondly, now both nominal subtyping and structural subtyping via protocols
properly take into account type parameters "fixed" on inheritance. Previously,
it was done only for receivers in methods calls and attribute reads.

It fixes PY-27707, PY-35026, PY-38897.

GitOrigin-RevId: ff4e61fb9b4aff079e67b2e5263f30552da15c63
2023-01-24 08:56:41 +00:00
Irina Fediaeva
058257cb23 PY-56609: Review remarks
Proper html table row tags

GitOrigin-RevId: 8413ddf84bc1d5d65080447e3f425923cca21c10
2023-01-23 13:39:15 +00:00
Irina Fediaeva
90f54814ca PY-57157: Support markdown in attributes and parameters quick documentation popups
GitOrigin-RevId: c4f1910784494ae9445cdc97dd3528e8cc35714a
2023-01-23 13:39:07 +00:00
Irina Fediaeva
252e4c1684 PY-56609: Refactoring in quick documentation
Replace usages of appendRaw by append

GitOrigin-RevId: 3ee71857898c3303a5c2e96939ab1f9fb91670e0
2023-01-23 13:39:05 +00:00
Irina Fediaeva
c44fb89c28 PY-56609: Refactoring in quick documentation
Migrate to DocumentationMarkup elements

GitOrigin-RevId: ea4d71638b1dd3a160521e655fd2a1670ea27701
2023-01-23 13:39:02 +00:00
Irina Fediaeva
492065b694 PY-56609: Refactoring in quick documentation
Clarify building docstring logic a little bit

GitOrigin-RevId: 8cc52a65829957917a285a6c77d42baa6b0b6cfd
2023-01-23 13:39:00 +00:00
Irina Fediaeva
dac98c01ed PY-56609: Refactoring in quick documentation
Cleanup DocumentationBuilderKit

GitOrigin-RevId: 85d8f4de5bc7ea6f9bf0ca298a7f29f180cb1e06
2023-01-23 13:38:55 +00:00
Irina Fediaeva
bd1c830040 PY-56609: Refactoring in quick documentation
Remove ChainIterable usages from quick documentation and replace with HtmlChunk/HtmlBuilder.
I18ize some fragments.

GitOrigin-RevId: c9b1197efcb17de92361426759a7840ee1be8e4b
2023-01-23 13:38:53 +00:00
Irina Fediaeva
5e4087e221 PY-56609: Refactoring in quick documentation
Streamline docstring logic in PyDocumentationBuilder

GitOrigin-RevId: 2cc1df0794890cefec37d6e5c4170587a3fa1973
2023-01-23 13:38:50 +00:00
Irina Fediaeva
98f4edc289 PY-56609: Refactoring in quick documentation
Simplify DocStringParameterReference

GitOrigin-RevId: 1cfd861cec23d9f7a41d630212a19e41ddae40b7
2023-01-23 13:38:43 +00:00