ruff
76868614 - Add support for unions to our Python builtins type system (#6541)

Commit
2 years ago
Add support for unions to our Python builtins type system (#6541) ## Summary Fixes some TODOs introduced in https://github.com/astral-sh/ruff/pull/6538. In short, given an expression like `1 if x > 0 else "Hello, world!"`, we now return a union type that says the expression can resolve to either an `int` or a `str`. The system remains very limited, it only works for obvious primitive types, and there's no attempt to do inference on any more complex variables. (If any expression yields `Unknown` or `TypeError`, we propagate that result throughout and abort on the client's end.)
Author
Parents
Loading