ruff/crates/red_knot_python_semantic
David Peter c6ce52c29e
[red-knot] Treat empty intersection as 'object', fix intersection simplification (#13880)
## Summary

- Properly treat the empty intersection as being of type `object`.
- Consequently, change the simplification method to explicitly add
`Never` to the positive side of the intersection when collapsing a type
such as `int & str` to `Never`, as opposed to just clearing both the
positive and the negative side.
- Minor code improvement in `bindings_ty`: use `peekable()` to check
whether the iterator over constraints is empty, instead of handling
first and subsequent elements separately.

fixes #13870

## Test Plan

- New unit tests for `IntersectionBuilder` to make sure the empty
intersection represents `object`.
- Markdown-based regression test for the original issue in #13870
2024-10-22 21:02:46 +02:00
..
resources [red-knot] Treat empty intersection as 'object', fix intersection simplification (#13880) 2024-10-22 21:02:46 +02:00
src [red-knot] Treat empty intersection as 'object', fix intersection simplification (#13880) 2024-10-22 21:02:46 +02:00
tests [red-knot] Cleanup generated names of mdtest tests (#13831) 2024-10-20 15:11:53 +00:00
build.rs Modernize build scripts (#13837) 2024-10-20 22:35:35 +01:00
Cargo.toml [red-knot] Cleanup generated names of mdtest tests (#13831) 2024-10-20 15:11:53 +00:00