Files
openide/python/python-psi-impl
Mikhail Golubev 99a6645e5d PY-36889 Type check assignments to class/instance attributes outside of class bodies
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
2024-11-19 17:25:06 +00:00
..