Skip to content

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Apr 30, 2025

Summary

This PR addresses @carljm's review comment in #17682 (comment).

A meaningful order between two types can only be established if the types have been normalized. This invariant is already asserted in various places throughout type_ordering.rs, but it makes more sense to assert the invariant once at the top of the function, with a better error message.

Test Plan

  • cargo test -p red_knot_python_semantic
  • QUICKCHECK_TESTS=100000 cargo test --release -p red_knot_python_semantic -- --ignored types::property_tests::stable

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Apr 30, 2025
@github-actions
Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅

@AlexWaygood AlexWaygood merged commit b84b587 into main Apr 30, 2025
35 checks passed
@AlexWaygood AlexWaygood deleted the alex/type-ordering-assertions branch April 30, 2025 10:58
dcreager added a commit that referenced this pull request Apr 30, 2025
* main:
  [red-knot] Use 'full' salsa backtrace output that includes durability and revisions (#17735)
  [red-knot] Initial support for protocol types (#17682)
  [red-knot] Computing a type ordering for two non-normalized types is meaningless (#17734)
  [red-knot] Include salsa backtrace in check and mdtest panic messages (#17732)
  [red-knot] Fix control flow for `assert` statements (#17702)
  [red-knot] Fix recording of negative visibility constraints (#17731)
  [red-knot] Update salsa (#17730)
  [red-knot] Support overloads for callable equivalence (#17698)
  [red-knot] Run py-fuzzer in CI to check for new panics (#17719)
  Upload red-knot binaries in CI on completion of linux tests (#17720)
  [`flake8-use-pathlib`] Fix `PTH123` false positive when `open` is passed a file descriptor from a function call (#17705)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants