ruff/crates
Carl Meyer fdca2b422e
[red-knot] all types are assignable to object (#15332)
## Summary

`Type[Any]` should be assignable to `object`. All types should be
assignable to `object`.

We specifically didn't understand the former; this PR adds a test for
it, and a case to ensure that `Type[Any]` is assignable to anything that
`type` is assignable to (which includes `object`).

This PR also adds a property test that all types are assignable to
object. In order to make it pass, I added a special case to check early
if we are assigning to `object` and just return `true`. In principle,
once we get all the more general cases correct, this special case might
be removable. But having the special case for now allows the property
test to pass.

And we add a property test that all types are subtypes of object. This
failed for the case of an intersection with no positive elements (that
is, a negation type). This really does need to be a special case for
`object`, because there is no other type we can know that a negation
type is a subtype of.

## Test Plan

Added unit test and property test.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-01-07 15:19:07 -08:00
..
red_knot Upgrade salsa (#15039) 2024-12-17 15:50:33 +00:00
red_knot_python_semantic [red-knot] all types are assignable to object (#15332) 2025-01-07 15:19:07 -08:00
red_knot_server Upgrade salsa (#15039) 2024-12-17 15:50:33 +00:00
red_knot_test Attribute panics to the mdtests that cause them (#15241) 2025-01-03 13:45:56 -05:00
red_knot_vendored Sync vendored typeshed stubs (#15213) 2025-01-01 01:14:40 +00:00
red_knot_wasm Rename custom-typeshed-dir, target-version and current-directory CLI options (#14930) 2024-12-13 08:21:52 +00:00
red_knot_workspace Don't special-case class instances in binary expression inference (#15161) 2025-01-06 13:50:20 -05:00
ruff Better error message when --config is given a table key and a non-inline-table value (#15266) 2025-01-06 13:20:28 +00:00
ruff_benchmark [red-knot] all types are assignable to object (#15332) 2025-01-07 15:19:07 -08:00
ruff_cache Fix cache key collisions for paths with separators (#12159) 2024-07-03 07:36:46 -05:00
ruff_db Attribute panics to the mdtests that cause them (#15241) 2025-01-03 13:45:56 -05:00
ruff_dev Alternate quotes for strings inside f-strings in preview (#13860) 2024-10-23 07:57:53 +02:00
ruff_diagnostics Show errors for attempted fixes only when passed --verbose (#15237) 2025-01-03 08:50:13 -06:00
ruff_formatter More typos found by codespell (#14880) 2024-12-09 22:47:34 +00:00
ruff_graph type: ignore[codes] and knot: ignore (#15078) 2024-12-23 10:52:43 +01:00
ruff_index [red-knot] small efficiency improvements and bugfixes to use-def map building (#12373) 2024-07-18 09:24:58 -07:00
ruff_linter [ruff] Parenthesize arguments to int when removing int would change semantics in unnecessary-cast-to-int (RUF046) (#15277) 2025-01-07 21:43:50 +00:00
ruff_macros [red-knot] Add infrastructure to declare lints (#14873) 2024-12-10 16:14:44 +00:00
ruff_notebook Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
ruff_python_ast [RUF] Add rule to detect empty literal in deque call (RUF025) (#15104) 2025-01-03 11:57:13 +01:00
ruff_python_ast_integration_tests Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_python_codegen ruff_python_ast: Make Singleton Copy (#14943) 2024-12-12 20:49:54 +01:00
ruff_python_formatter Preserve multiline implicit concatenated strings in docstring positions (#15126) 2025-01-03 10:27:14 +01:00
ruff_python_index Extract LineIndex independent methods from Locator (#13938) 2024-10-28 07:53:41 +00:00
ruff_python_literal Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
ruff_python_parser Modify parsing of raise with cause when exception is absent (#15049) 2024-12-19 13:36:32 +00:00
ruff_python_resolver Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_python_semantic Revert "Add all PEP-585 names to UP006 rule" (#15250) 2025-01-04 12:23:53 +01:00
ruff_python_stdlib Revert "Add all PEP-585 names to UP006 rule" (#15250) 2025-01-04 12:23:53 +01:00
ruff_python_trivia type: ignore[codes] and knot: ignore (#15078) 2024-12-23 10:52:43 +01:00
ruff_python_trivia_integration_tests Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_server Check diagnostic refresh support from client capability (#15014) 2024-12-16 16:26:40 +05:30
ruff_source_file [pyupgrade] Do not report when a UTF-8 comment is followed by a non-UTF-8 one (UP009) (#14728) 2024-12-11 10:30:41 +00:00
ruff_text_size Extract LineIndex independent methods from Locator (#13938) 2024-10-28 07:53:41 +00:00
ruff_wasm Ruff 0.8.6 (#15253) 2025-01-04 13:09:26 +01:00
ruff_workspace [flake8-bugbear] Implement class-as-data-structure (B903) (#9601) 2025-01-06 21:18:28 -06:00