Also, don't query LanguageLevel for each element of each instruction,
only once per scope traversal.
This doesn't fix the problem with unreachable definition *inside* blocks under
unmatched version checks, i.e.
if sys.version_info < (3, 8):
Alias = int
expr: Alias # unresolved
but it's a more difficult problem how to handle those consistently with the idea
of unreachable version checks under the *current* interpreter version, and hopefully
it occurs rarer than, say, unresolved top-level imports of common names from typing.
(cherry picked from commit 55fd4597c6d0860d290caba15fbf4d313e985a86)
IJ-CR-149696
GitOrigin-RevId: 357ada7e10618aef75c470e6cd878f7672109e83
Because async generator methods in ABC and protocols are supposed to be declared as
plain "def" methods so as not to confuse type checkers with their AsyncIterable
return type annotations, it's better to disable such type-hint re-use if methods
async-ness don't match and not wrap anything in typing.Coroutine implicitly.
See also https://mypy.readthedocs.io/en/stable/more_types.html#asynchronous-iterators
(cherry picked from commit 6342f15a7786ec0d02ee1ab2b18fd40fd1ca1430)
IJ-CR-149694
GitOrigin-RevId: 3e19f190d9334e6c8648462ebb5b61abe931b0e6
We now allow spaces in project path (`validatePath`) but convert them to underlines for `projectName` (both changes are in `ProjectPathFlows`).
(cherry picked from commit cc875f7b4e6d2354fba79387a0fc9161a6d267e1)
GitOrigin-RevId: 620e5bca8a406c9588f3e4f54260e5e3162bf686
`versionString` might be `null` if python in severe broken.
Such pythons shouldn't be here, and we will fix it as soon as we introduce PythonInterpreterService
(cherry picked from commit d4658e07833d6f886991e794f90e5a16f28e50c3)
IJ-CR-150093
GitOrigin-RevId: e0fe53bdacbd014afa67115c9c9414a0cba9ba59
Assume we have the following sequence of events:
1. SDK list is empty
2. `setItems` gets called
3. SDK list set its status to "busy"
4. It gets filled with interpreters and first one is chosen
5. "Busy" flag is removed
For validation, we used to check "Busy" flag only: when it was "busy" we disabled "OK" button.
But before step 3 it isn't busy nor it has interpreter set. Clicking "OK" at this moment might lead to NPE (see the issue).
We now check if value is set fore validation.
(cherry picked from commit 99554914cb7dc67158828559ba2e6da81fdfe350)
IJ-CR-149868
GitOrigin-RevId: d50ffa6025238d515fc387c562f15f370ba1278c
Previously, PyTypingTypeProvider.getReferenceType returned a type from a class attribute
type hint only for assignment to instance attribute located inside a class definition.
In other words, here we inferred the expected type from the annotation
and reported incompatible types in assignment:
```python
class C:
attr: int
def m(self):
self.attr = "foo"
```
but in the following we didn't:
```python
class C:
attr: int
inst = C()
inst.attr = "foo"
```
Now we try to resolve any qualified target expression to a class
or instance attribute and then infer the type from the corresponding
annotation.
(cherry picked from commit 086dbb678a8cd89cfe332bf801631568fb6c3a4d)
IJ-MR-147382
GitOrigin-RevId: 4e3f71baa598d4caf684d0aeab23d1a9a688b94d
Associate poetry files ("poetry.lock", "pyproject.toml") with the Python Packages toolwindow.
Separate UI error handling from package management logic.
Add tests to check the installation and removal of packages using poetry and "pyproject.toml" modification.
Merge-request: IJ-MR-146002
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
(cherry picked from commit 2ab0816f10c970f738d6d931dc123481030cad38)
Merge-request: IJ-MR-148435
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
GitOrigin-RevId: be957c5343b73264c78134f156ad0e4034b912f9
Platform expands project view automatically once `generateProject` returns but only if it isn't empty. As we generate things in background (see `.launch`) nothing is expanded.
So we expand it explicitly 2 times: when SDK is generated and when project is generated. At least one of these actions must create files which is required to expand the tree.
This code can't be tested because there is no project view tree in a headless mode.
(cherry picked from commit 2390d09619639e8ff8d8906a4e0a284cf24da5ba)
KT-MR-18605
GitOrigin-RevId: 115034e348c029ea751072caacf4220d121bc220
Previously, we reported call arguments only if either all callee
candidates have unmatched arguments or all call candidates have
unmatched parameters. When there was a mix of the two, we reported
nothing.
(cherry picked from commit 97b42faf10de74ee7cd10f934d9eb94e1c8bbb34)
IJ-CR-146869
GitOrigin-RevId: 8babfe6a8ad0152f985655eff27df4df68936594