Handle maybe-unbound __iadd__-like operators in augmented assignments (#14044)

## Summary

One of the follow-ups from augmented assignment inference, now that
`Type::Unbound` has been removed.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Charlie Marsh
2024-11-01 13:15:35 -04:00
committed by GitHub
parent 099f077311
commit 487941ea66
2 changed files with 29 additions and 9 deletions

View File

@@ -85,7 +85,7 @@ f = Foo()
# that `Foo.__iadd__` may be unbound as additional context.
f += "Hello, world!"
reveal_type(f) # revealed: int
reveal_type(f) # revealed: int | @Todo
```
## Partially bound with `__add__`
@@ -104,8 +104,7 @@ class Foo:
f = Foo()
f += "Hello, world!"
# TODO(charlie): This should be `int | str`, since `__iadd__` may be unbound.
reveal_type(f) # revealed: int
reveal_type(f) # revealed: int | str
```
## Partially bound target union